Spring Boot 应用程序在 IntelliJ 中启动失败

我以前有 Spring Boot 应用程序,我曾经在 Eclipse 中使用过它在那里工作,最近切换到 IntelliJ,在 IntelliJ 应用程序中没有盯着,在这里我在启动时共享日志


  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::        (v2.0.0.RELEASE)


2019-09-20 13:34:56.609  INFO 30977 --- [  restartedMain] com.kn.Application                       : Starting Application on Dhanu-MAC.local with PID 30977 (/Applications/Data/RT/20190815_source_prod/2_etn_backend/target/classes started by dhanu in /Applications/Data/RT/20190815_source_prod/2_etn_backend)

2019-09-20 13:34:56.621  INFO 30977 --- [  restartedMain] com.kn.Application                       : The following profiles are active: dev

WARNING: An illegal reflective access operation has occurred

WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/Users/dhanu/.m2/repository/org/codehaus/groovy/groovy/2.4.13/groovy-2.4.13.jar) to method java.lang.Object.finalize()

WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass

WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations

WARNING: All illegal access operations will be denied in a future release

正如我在日志中看到的,它已成功与数据库连接,但 tomcat 停止了,没有显示任何原因


我在这里呆了很长一段时间,有人可以帮忙吗?


qq_笑_17
浏览 124回答 1
1回答

白板的微信

嵌套异常是java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement简而言之:随着 Java 9 的发布,所需的依赖项已从 JDK 中删除。如果您使用 Java 8 JDK 启动应用程序,则会提供依赖项并且您的应用程序可以正常运行。如果您使用 Java 9 JDK 或更高版本启动应用程序,则依赖项将不再存在并且无法启动。修复此问题的正确解决方案是将所需的依赖项添加到您的项目中:dependencies {    // JAX-B dependencies for JDK 9+    implementation "javax.xml.bind:jaxb-api:2.2.11"    implementation "com.sun.xml.bind:jaxb-core:2.2.11"    implementation "com.sun.xml.bind:jaxb-impl:2.2.11"    implementation "javax.activation:activation:1.1.1"}Maven 依赖项<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->        <dependency>            <groupId>javax.xml.bind</groupId>            <artifactId>jaxb-api</artifactId>            <version>2.2.11</version>        </dependency>        <!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-core -->        <dependency>            <groupId>com.sun.xml.bind</groupId>            <artifactId>jaxb-core</artifactId>            <version>2.2.11</version>        </dependency>        <!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl -->        <dependency>            <groupId>com.sun.xml.bind</groupId>            <artifactId>jaxb-impl</artifactId>            <version>2.2.11</version>        </dependency>        <!-- https://mvnrepository.com/artifact/javax.activation/activation -->        <dependency>            <groupId>javax.activation</groupId>            <artifactId>activation</artifactId>            <version>1.1.1</version>        </dependency>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java