java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter 解决方法

idea 我这里虽然电脑上安装的是jdk1.8,但是idea默认使用了jdk 11

方式1:降低jdk版本为1.8 (我这里使用了第一种方法)

方式2:手动引入相关jar包

<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>

具体原因请查看:https://www.cnblogs.com/smfx1314/p/11071718.html

2022-01-12 第二种方式已验证可以使用

但是会爆以下错误,但是不影响程序的正常运行

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/F:/local/repo/org/springframework/spring-core/5.2.4.RELEASE/spring-core-5.2.4.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils
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

原文地址:https://www.cnblogs.com/rchao/p/15543042.html