gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 16:28:31 24 4
gpt4 key购买 nike

我在尝试配置 selenium webdriver 来测试我的 Spring Boot 应用程序时遇到了各种问题。每次我将 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 缓存中的一个 jar 已损坏。

就您而言,以下文件似乎已损坏:

file:/C:/Users/Usuario/.m2/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar
<小时/>

解决方案

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

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

<小时/>

片尾

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

关于java.lang.IllegalStateException : Failed to read Class-Path attribute from manifest of jar error using Selenium through Maven in Spring Boot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62106284/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com