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.