Servlet mapping specifies an unknown servlet name servlet2S

解决方案 »

  1.   

    在eclipse中启动tomcat时就有这个问题啊
      

  2.   

    webxml  检查。 servlet2S  对应的
      

  3.   

    就没有servlet2s这个东西  找不到
      

  4.   

    web.xml贴出来url mapping写错了
      

  5.   

    <?xml version="1.0" encoding="ISO-8859-1"?><web-app xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                          http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0">    <servlet>
            <servlet-name>default</servlet-name>
            <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
            <init-param>
                <param-name>debug</param-name>
                <param-value>0</param-value>
            </init-param>
            <init-param>
                <param-name>listings</param-name>
                <param-value>false</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>    <servlet>
            <servlet-name>jsp</servlet-name>
            <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
            <init-param>
                <param-name>fork</param-name>
                <param-value>false</param-value>
            </init-param>
            <init-param>
                <param-name>xpoweredBy</param-name>
                <param-value>false</param-value>
            </init-param>
            <load-on-startup>3</load-on-startup>
        </servlet>    <!-- The mapping for the default servlet -->
        <servlet-mapping>
            <servlet-name>default</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>    <!-- The mappings for the JSP servlet -->
        <servlet-mapping>
            <servlet-name>jsp</servlet-name>
            <url-pattern>*.jsp</url-pattern>
            <url-pattern>*.jspx</url-pattern>
        </servlet-mapping>
     <!-- ==================== Default Welcome File List ===================== -->
      <!-- When a request URI refers to a directory, the default servlet looks  -->
      <!-- for a "welcome file" within that directory and, if present, to the   -->
      <!-- corresponding resource URI for display.                              -->
      <!-- If no welcome files are present, the default servlet either serves a -->
      <!-- directory listing (see default servlet configuration on how to       -->
      <!-- customize) or returns a 404 status, depending on the value of the    -->
      <!-- listings setting.                                                    -->
      <!--                                                                      -->
      <!-- If you define welcome files in your own application's web.xml        -->
      <!-- deployment descriptor, that list *replaces* the list configured      -->
      <!-- here, so be sure to include any of the default values that you wish  -->
      <!-- to use within your application.                                       -->    <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list></web-app>
      

  6.   

    问题已然解决了 
    在context.xml文件中加入<Loader delegate="true"/>这行代码
      

  7.   

    到workspace里面将.metadata文件删掉,然后重新部署tomcat,问题解决。(也有风险,eclipse里的诸多设置会没有,比如字体等等)
      

  8.   

    我也碰到一模一样的问题,你那个<Loader delegate="true"/>这行代码加在哪里呀