搭建EurekaServer注册中心报错:Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
错误异常:Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
今天搭建springcloud项目部署EurekaServer注册中心报错:然后报错项目无法运行起来。
出现错误的原因:
从java9开始,项目就不会默认加载jdk中的jaxb包,所以此处手动引入jaxb-api包
解决方案:
jaxb包是存储在jdk中的,但从java9开始,项目在加载的过程中便不再默认加载这个包了,所以此处我们需要在项目的pom.xml文件中手动添加依赖。
如果是java8 及以下的版本,可能就要寻找其他解决方案了。
<!-- 从java9开始,项目就不会默认加载jdk中的jaxb包,所以此处手动引入jaxb-api包 -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.2.10-b140310.1920</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>

浙公网安备 33010602011771号