1. 程式人生 > >IDEA 的 Jetty 啟動成功,執行 JSP 頁面報錯

IDEA 的 Jetty 啟動成功,執行 JSP 頁面報錯

IDEA 的 Jetty-runner 外掛執行 JSP 頁面報錯:No org.apache.tomcat.InstanceManager set in ServletContext

原因:版本的對應關係

需要確保 web.xml 中定義的 servlet 版本和 pom.xml 中引入的 servlet 版本是一致的

web.xml

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                             http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 
         version="3.1">

pom.xml

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
</dependency>

記錄一下。