当前位置:   article > 正文

【解决】nested exception is org.springframework.boot.web.server.WebServerException Unable to start

nested exception is org.springframework.boot.web.server.webserverexception:
【问题描述】:IDEA发布SpringBoot工程时,出现了该异常,一直发布不成功,报了以下的错误

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>`
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

法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>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

不过问题解决了,以此记录

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/153958?site
推荐阅读
相关标签
  

闽ICP备14008679号