gpt4 book ai didi

java - Spring Boot 应用程序无法以类路径 : [] 启动

转载 作者:搜寻专家 更新时间:2023-10-30 21:08:09 25 4
gpt4 key购买 nike

我用 jHipster 生成了一个 Spring Boot 应用程序,添加了我之前项目(非 jhipster 项目)中的一些代码,并尝试使用 IDEA 运行它。首先,我收到类似于 this 的错误消息,说“命令行太长..”(我运行的是 Windows 10 x64)。我点击了启用,但随后出现了这样的错误:

"C:\Program Files\Java\jdk1.8.0_144\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:51351,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=51350 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath C:\Users\User\AppData\Local\Temp\classpath.jar com.test.pc.TestPartsComposerApp
Connected to the target VM, address: '127.0.0.1:51351', transport: 'socket'
The Class-Path manifest attribute in C:\Users\User\AppData\Local\Temp\classpath.jar referenced one or more files that do not exist: .... Extremely long list of jars
07:48:56.779 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
07:48:56.779 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/]
07:48:56.779 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : []

07:48:57.570 [restartedMain] DEBUG org.springframework.boot.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: []

在我尝试使用 ./mvnw 之后:

The Class-Path manifest attribute in C:\Users\User\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.3-1\jaxb-impl-2.2.3-1.jar referenced one or more files that do not exist: C:\Users\User\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.3-1\jaxb-api.jar,C:\Users\User\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.3-1\activation.jar,C:\Users\User\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.3-1\jsr173_1.0_api.jar,C:\Users\User\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.3-1\jaxb1-impl.jar
The Class-Path manifest attribute in C:\Users\User\.m2\repository\org\liquibase\liquibase-core\3.5.3\liquibase-core-3.5.3.jar referenced one or more files that do not exist: C:\Users\User\.m2\repository\org\liquibase\liquibase-core\3.5.3\lib\snakeyaml-1.13.jar
07:53:54.295 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
07:53:54.295 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/]
07:53:54.295 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/C:/workspace/jh-fpc/TestPartsComposer/target/classes/]
07:53:55.295 [restartedMain] DEBUG org.springframework.boot.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/C:/workspace/jh-fpc/TestPartsComposer/target/classes/]

我发布了我的pom.xml here .

我创建了一个全新的项目,并开始逐一添加我拥有的 Maven 依赖项,并在每一步之后运行该项目。当我将 BOTH spring-batch 和 guava 添加到 pom 时,会出现类路径问题。

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava-core.version}</version>
</dependency>

最佳答案

我在具有相同错误消息的 jHipster 应用程序中遇到了同样的问题,对我来说,根本原因是 application-dev.yml 中 spring 邮件设置的格式(缩进)错误。我只是从另一个项目复制/粘贴设置,IntelliJ 对它们的缩进与原始代码中的略有不同,因此无法解析它们。

那些“ list 属性”的东西每次启动应用程序时都会出现,但至少对我来说它们与真正的问题无关。希望这有助于找到原因的根源!干杯,

关于java - Spring Boot 应用程序无法以类路径 : [] 启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46599698/

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