在spring boot 环境中加启动时,出现以下异常:java
nable to start embedded container; nested exception is java.lang.NoSuchMethodError: javax.servlet.ServletContext.addServlet(Ljava/lang/String;Ljavax/servlet/Servlet;)Ljavax/servlet/ServletRegistration$Dynamic;spring
解决方案:api
通过检查是因为 servlet-api.jar 冲突致使,取消servlet-api.jar 导入 servlet
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>io