赞
踩
nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded
因为SpringBoot是内嵌了Tomcat服务器的,出现该问题的话,明显是因为Tomcat没有配置好,网络上有说包冲突的,这里希望大家在自己的项目文件中查询下,能否找到下面这个包:
如果能找到以上的包,则说明您应该是出现了 tomcat 相关包之间的冲突,如果没有该包,则最好在pom.xml 中引入 tomcat 包
法1
原则上 pom.xml 中引入下面的内容,可以直接解决问题的
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!-- 也有人说这个 provided 可能有问题,具体可以自行测试-->
<scope>provided</scope>
</dependency>`
法2(我用的该方法)
同样是在pom.xml中加入 spring-boot-starter相关的组件
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<!-- 其实我感觉是上面的 parent 发挥的作用,下面这些包,似乎没什么影响-->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
不过问题解决了,以此记录
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。