jsfglassfishinfinite-loopfacesservlet

PWC1232: Exceeded maximum depth for nested request dispatches: 20 at org.apache.catalina.core.ApplicationDispatcher.doInvoke


I am using jsf 2.1 (mojara) with glassfish 3.1 , and my web .xml looks like :

  <welcome-file-list>
    <welcome-file>NewFile.xhtml</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
  <context-param>

I am getting this error

2015-03-11T21:40:15.054+0530|Warning: ApplicationDispatcher[/JSFProject] PWC1231: Servlet.service() for servlet Faces Servlet threw exception javax.servlet.ServletException: PWC1232: Exceeded maximum depth for nested request dispatches: 20 at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:772)


Solution

  • This problem suggests that you're using JSF 1.x, not JSF 2.x. JSF 1.x uses JSP as default view technology whereas JSF 2.x uses Facelets as default view technology. And, JSF 1.x has the known bug ("feature") that its FacesServlet would run in an infinite loop when it's being mapped on same suffix URL pattern as the physical view file.

    And indeed, your /WEB-INF/lib contains among others the following JARs which absolutely do not belong there. GlassFish as being a full fledged Java EE container already ships with Servlet and JSF API/impl out the box.

    Get rid of them. Even then, you should not be mixing multiple JSF implementations in one webapp.