澄清web.xml中的servlet映射错误

时间:2017-11-02 19:02:12

标签: xml tomcat servlets web.xml

有人可以告诉我这个web.xml servlet映射有什么问题吗?

当我在tomcat中部署应用程序时,它会提供404错误代码。在我为 AdminUserManagerServlet 创建一个新的servlet映射之后计算它的到来。有人可以告诉我这里的错误是什么? 当有过滤器映射和侦听器时,是否有正确的方法来添加多个servlet映射? 有人可以告诉我错误以及如何解决这个问题? 非常感谢!

<display-name>Travelocity.COM</display-name>


<servlet>
    <servlet-name>ForwardingServlet</servlet-name>
    <servlet-class>org.test.com.sso.agent.ForwardingServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet>
    <servlet-name>AdminUserManagerServlet</servlet-name>
    <servlet-class>org.test.com.sso.agent.AdminUserStoreManager</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>ForwardingServlet</servlet-name>
    <url-pattern>/samlsso</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>ForwardingServlet</servlet-name>
    <url-pattern>/openid</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>ForwardingServlet</servlet-name>
    <url-pattern>/token</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>ForwardingServlet</servlet-name>
    <url-pattern>/logout</url-pattern>
</servlet-mapping>

 <servlet-mapping>
    <servlet-name>AdminUserManagerServlet</servlet-name>
    <url-pattern>/rolesubmit</url-pattern>
</servlet-mapping>

<filter>
    <filter-name>SSOAgentSampleFilter</filter-name>
    <filter-class>org.test.com.sso.agent.SSOAgentSampleFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>SSOAgentSampleFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>SSOAgentSampleFilter</filter-name>
    <url-pattern>/samlsso</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>SSOAgentSampleFilter</filter-name>
    <url-pattern>/openid</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>SSOAgentSampleFilter</filter-name>
    <url-pattern>/token</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>SSOAgentSampleFilter</filter-name>
    <url-pattern>/logout</url-pattern>
</filter-mapping>

<listener>
    <listener-class>org.test.com.sso.agent.SampleContextEventListener</listener-class>
</listener>

<listener>
    <listener-class>org.testi.com.identity.sso.agent.saml.SSOAgentHttpSessionListener</listener-class>
</listener>


<error-page>
    <exception-type>org.tesi.com.identity.sso.agent.SSOAgentException</exception-type>
    <location>/errors.jsp</location>
</error-page>

1 个答案:

答案 0 :(得分:0)

两个servlet都将<load-on-startup>属性设置为1.该值假定代表servlet的启动顺序。我建议你将1设置为0,将另一个设置为1