Build springboot recently launched an error: org. Springframework. Boot.. Web server WebServerException: Unable to start embedded Tomcat error message is as follows:

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationCon Text. Java: 155) ~ [spring - the boot - 2.0.2. The jar: 2.0.2. RELEASE] the at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~ [spring - the context - 5.0.6. RELEASE. The jar: 5.0.6. RELEASE] the at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationConte Xt. Java: 140) ~ [spring - the boot - 2.0.2. The jar: 2.0.2. RELEASE] the at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring - the boot - 2.0.2. RELEASE. The jar: 2.0.2. RELEASE] the at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring - the boot - 2.0.2. RELEASE. The jar: 2.0.2. RELEASE] the at Org. Springframework. Boot. SpringApplication. Run (SpringApplication. Java: 327) [spring - the boot - 2.0.2. The jar: 2.0.2. RELEASE]  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring - the boot - 2.0.2. RELEASE. The jar: 2.0.2. RELEASE] the at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring - the boot - 2.0.2. RELEASE. The jar: 2.0.2. RELEASE] at com. Ecjtu. Demo. DemoApplication. Main (15) DemoApplication. Java: [classes/:?] Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded TomcatCopy the code

Various attempts have failed, but if @enableEurekaserver and the eureka configuration are removed, SpringBoot will start normally. Did along while, the net checked next, the original is JDK version problem. Starting with java9, the concept of modularity meant that JAXB was not loaded by default; Jaxb-api exists in the JDK, but it’s not loaded by default, so you’ll need to import it manually. The following JAXB dependencies are introduced:

<dependency> <groupId>javax.xml.bind</groupId> <artifactId> JAXB-API </artifactId> <version>2.3.0</version> </dependency> < the 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 > < the dependency > < groupId > javax.mail. Activation < / groupId > < artifactId > activation < / artifactId > < version > 1.1.1 < / version > < / dependency >Copy the code

Start SpringBoot again and the project is successfully started!