解決錯誤:Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlType

今天運行項目時出錯,緣由是原項目在jdk1.8下運行的,升級成jdk11以後缺了一些jar包。

舒適提示:你們在作項目時必定要注意版本問題。

解決方案一:

下降JDK 版本到 JDK 8java

解決方案二:

在pom.xml文件中添加以下依賴:api

<dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-core</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1.1</version> </dependency> 

 至此,問題完美解決,項目成功運行!spa

相關文章
相關標籤/搜索