Spring Boot应用程序无法以classpath启动:[]

sza*_*kel 12 java intellij-idea maven spring-boot jhipster

我使用jHipster生成了一个Spring Boot应用程序,添加了我之前项目(非jhipster项目)中的一些代码,并尝试使用IDEA运行它.首先我收到类似于的错误消息,说"命令行太长了..."(我正在运行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: []
Run Code Online (Sandbox Code Playgroud)

我试过之后./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/]
Run Code Online (Sandbox Code Playgroud)

我在pom.xml 这里发布.

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

<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>
Run Code Online (Sandbox Code Playgroud)

小智 12

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

每次启动应用程序时都会出现这些"清单属性",但至少对我来说,它们与真正的问题无关.希望这有助于找到事业的根源!干杯,

  • 我检查了我的`application-*。yml`文件,发现由于`tab`字符而无法启动。我改为插入4个空格,并且它再次起作用。 (2认同)

Li *_*ing 6

此错误消息由ClasspathLoggingApplicationListener#onApplicationEvent输出

但它不会输出错误的真正原因。

所以,你应该在调试模式下启动你的应用程序,并在这一行添加一个断点,然后你可以检查event.exception,并找出真正发生的错误。

这个问题浪费了我 30 分钟......希望这个答案可以节省一些时间