Eurera的JDK9.0的依赖问题

mac2022-06-30  34

在Springcloud中,需要使用eureka微服务来管理远程调用过程.

           在jdk8中,导入依赖:

             <dependency>

                       <groupId>org.springframework.cloud</groupId>

                      <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> 

     </dependency>

        配置好Application后即可使用. 但是在升级到JDK9后,出现依赖包异常,启动不成功.

       出现此异常: java.lang.TypeNotPresentException: Type javax.xml.bind.JAXBContext not present

解决方法: 

    加入一下依赖:

<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>因为JAXB-API是java ee的一部分,在jdk9中没有在默认的类路径中.

     

转载于:https://www.cnblogs.com/qiujinming/p/11479661.html

最新回复(0)