亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Spring Boot 應用程序在 IntelliJ 中啟動失敗

Spring Boot 應用程序在 IntelliJ 中啟動失敗

qq_笑_17 2023-08-16 10:10:02
我以前有 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: devWARNING: An illegal reflective access operation has occurredWARNING: 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.CachedClassWARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operationsWARNING: All illegal access operations will be denied in a future release正如我在日志中看到的,它已成功與數據庫連接,但 tomcat 停止了,沒有顯示任何原因我在這里呆了很長一段時間,有人可以幫忙嗎?
查看完整描述

1 回答

?
白板的微信

TA貢獻1883條經驗 獲得超3個贊

嵌套異常是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>


查看完整回答
反對 回復 2023-08-16
  • 1 回答
  • 0 關注
  • 166 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號