spring boot java.lang.NoSuchMethodError: javax.servlet.ServletContext.addServlet

在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

相關文章
相關標籤/搜索