美文网首页
Spring Cloud java.lang.TypeNotP

Spring Cloud java.lang.TypeNotP

作者: 扎你p屁 | 来源:发表于2018-11-20 15:24 被阅读0次

    今天在搭建spring cloud的时候,一直报“java.lang.TypeNotPresentException: Type javax.xml.bind.JAXBContext not present”的错误,是因为用了jdk10的缘故。因为JAXB-API是java ee的一部分,在jdk10中没有在默认的类路径中。从jdk9开始java引入了模块的概念,可以使用模块命令--add-modles java.xml.bind引入jaxb-api。也可以选择另一种解决方法,在maven里面加入下面依赖,可以解决这个问题:

    <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>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-runtime</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1.1</version>
    </dependency>
    

    相关文章

      网友评论

          本文标题:Spring Cloud java.lang.TypeNotP

          本文链接:https://www.haomeiwen.com/subject/mvkxqqtx.html