簡體   English   中英

java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar error using Selenium through Maven in Spring Boot

[英]java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar error using Selenium through Maven in Spring Boot

在嘗試配置 selenium webdriver 以測試我的 spring 啟動應用程序時,我遇到了各種問題。 每次我將 selenium 依賴項放入我的 pom.xml 時,它似乎破壞了我的 m2 存儲庫,或者這就是我的想法。

這是依賴:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.141.59</version>
</dependency>  

這是錯誤消息:

Exception in thread "main" java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar file:/C:/Users/Usuario/.m2/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar
at org.springframework.boot.devtools.restart.ChangeableUrls.getUrlsFromClassPathOfJarManifestIfPossible(ChangeableUrls.java:132)
at org.springframework.boot.devtools.restart.ChangeableUrls.fromClassLoader(ChangeableUrls.java:98)
at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getUrls(DefaultRestartInitializer.java:92)
at org.springframework.boot.devtools.restart.DefaultRestartInitializer.getInitialUrls(DefaultRestartInitializer.java:56)
at org.springframework.boot.devtools.restart.Restarter.<init>(Restarter.java:142)
at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:556)
at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationStartingEvent(RestartApplicationListener.java:76)
at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationEvent(RestartApplicationListener.java:50)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:69)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at pe.backend.BackendApplication.main(BackendApplication.java:10)

我曾嘗試多次清理我的 m2 存儲庫並添加不同版本的依賴項,但似乎並沒有解決它。 我也嘗試過使用全新安裝,但如果我放置了 selenium 依賴項,它會顯示構建錯誤。

此錯誤消息...

Exception in thread "main" java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar file:/C:/Users/Usuario/.m2/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar

...意味着 maven 緩存中的 jars 之一已損壞。

在您的情況下,以下文件似乎已損壞:

file:/C:/Users/Usuario/.m2/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar

解決方案

您需要從 maven 緩存中刪除特定的 jar 並重新構建您的應用程序。

由於您已經嘗試通過全新clean install m2存儲庫,但錯誤仍然存在,您可能需要硬刪除此特定jar並重建您的應用程序。


奧特羅

您可以在以下位置找到相關討論:

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM