java.lang.IllegalStateException:使用Selenium通过Spring Boot中的Maven无法从jar错误的清单中读取Class-Path属性

问题描述 投票:0回答:1

在尝试配置Selenium Webdriver来测试我的Spring Boot应用程序时,我遇到了各种各样的问题。每次我将硒依赖项放入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存储库并添加不同版本的依赖关系,但这似乎无法解决。我也尝试过使用全新安装,但是如果我放置了硒依赖项,它会显示生成错误。

java spring-boot selenium maven illegalstateexception
1个回答
0
投票

此错误消息...

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缓存中的一个jar已损坏。

您的情况,以下文件似乎已损坏:

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

解决方案

您需要从Maven缓存中删除特定的jar,然后重新构建应用程序。

由于您已经尝试通过m2多次清理clean install存储库,但是错误仍然存​​在,因此您可能需要删除这个特定的[[jar并重新构建应用程序。


Outro

您可以在以下位置找到相关的讨论:

© www.soinside.com 2019 - 2024. All rights reserved.