关于解决搭建Eureka出现的Unable to start embedded Tomcat;无法启动嵌入式tomcat异常
2020-08-14 19:26
1121 查看
今天在搭建Eureka的时候,死活都跑不起来!一直提示 Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat;无法启动嵌入式tomcat;
pom如下:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.6.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.itheima.eureka</groupId> <artifactId>itheima-eureka</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>itheima-eureka</name> <description>Demo project for Spring Boot</description> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <spring-cloud.version>Finchley.SR2</spring-cloud.version> </properties> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
application.yml配置
server: port: 10086 # 端口 spring: application: name: eureka-server # 微服务在容器中的名称,会在Eureka中显示 eureka: client: service-url: # EurekaServer的地址,现在是自己的地址,如果是集群,需要加上其它Server的地址。 defaultZone: http://127.0.0.1:${server.port}/eureka
引导类:
@SpringBootApplication @EnableEurekaServer //声明当前springboot应用是一个eureka服务中心 public class ItheimaEurekaApplication { public static void main(String[] args) { SpringApplication.run(ItheimaEurekaApplication.class, args); } }
此问题困扰了一下午,各种调试都无法解决;后来终于发现,是使用jdk版本的问题;
我使用的是java9版本,在java8及之前内置了jaxb-api包,但是java9及之后就没有引入这个包了,所以需要在pom中手动引入,如下配置文件。
<dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.0</version> </dependency>
在Spring Cloud官方也指出了:
在pom文件中做出如下配置,问题解决!!
<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-core</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.3.0</version> </dependency>
相关文章推荐
- 启动Tomcat出现“Bad version number in .class file (unable to load class XXX)”解决
- Eclipse中Tomcat7.0无法启动:unable to start within 45 seconds
- Eclipse出现Tomcat无法启动:Server Tomcat v8.5 Server at localhost failed to start问题
- 如何解决tomcat启动时出现 Server Tomcat v9.0 Server at localhost failed to start.
- hadoop 安装出现的几种异常的处理方法,hadoop无法启动,no namenode to stop问题的解决方法,no datanode
- 解决Tomcat解决启动时出现Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]的错误
- Unable to start embedded Tomcat错误解决
- Tomcat7.0无法启动解决方法[failed to start]
- 解决错误:the application was unable to start correctly 0xc00007b,应用程序无法正常启动(0xc000007b)
- 关于eclipse 运行了 maven install后 在tomcat中启动web项目出现classnofind的异常解决方法
- 当启动tomcat时候出现 Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds
- 当启动tomcat时候出现 Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds.
- 解决tomcat启动时erver Tomcat Server at localhost was unable to start within 45 seconds
- IDEA启动spring boot 出现Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletCont
- 关于Java web程序中出现Server Tomcat v8.0 Server at localhost failed to start.的问题解决办法
- 关于intentservice无法启动问题:Unable to instantiate service 的解决办法
- hadoop 安装出现的几种异常的处理方法,hadoop无法启动,no namenode to stop问题的解决方法,no datanode
- Tomcat启动出现:Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SpringMvc]]解决办法
- 解决Idea 无法启动tomcat项目。unable to open debugger port , java.net.SocketException "socket closed"
- 解决 Tomcat Server in Eclipse unable to start within 45 seconds 不能启动的问题