👨🏻💻 热爱摄影的程序员
👨🏻🎨 喜欢编码的设计师
🧕🏻 擅长设计的剪辑师
🧑🏻🏫 一位高冷无情的全栈工程师
欢迎分享 / 收藏 / 赞 / 在看!
【问题】
原项目在 JDK 1.8 下正常运行,但在 JDK 11 下运行报错缺了某些 jar 包:
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlType
【解决】
除了降低 JDK 版本的方法外,如果非要用 JDK 版本大于 1.8,则需在项目 pom 文件中添加相关依赖(根据实际需要添加):
<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>