Spring boot: Unable to start embedded Tomcat servlet container

后端 未结 8 1399
孤街浪徒
孤街浪徒 2020-12-09 15:26

I\'m new to Spring Boot and having with error while running my application. I\'m following a tutorial and I believe I\'m having proper parent and dependencies with POM, plea

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-09 16:06

    In my condition when I got an exception " Unable to start embedded Tomcat servlet container",

    I opened the debug mode of spring boot by adding debug=true in the application.properties,

    and then rerun the code ,and it told me that java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String

    Thus, we know that probably I'm using a servlet API of lower version, and it conflicts with spring boot version.

    I went to my pom.xml, and found one of my dependencies is using servlet2.5, and I excluded it.

    Now it works. Hope it helps.

提交回复
热议问题