Pregunta

I'm developing a web application at the moment. I'm using JSF 2 on a tomcat 6. Everything went great, but now I want to navigate through my pages... (I decided to do an XML-less JSF Navigation approach). For this I need to add a faces-config.xml. I did it, but after adding the faces-config I always get an error when I want to open my page.

    SCHWERWIEGEND: Servlet.service() for servlet Faces Servlet threw exception
    java.lang.StackOverflowError
        at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:216)
...

If I remove the faces-config everything works great (But then I have no navigation :( ).

Here are my maven dependencies: com.sun.faces jsf-api 2.1.2 com.sun.faces jsf-impl 2.1.2 javax.servlet jstl 1.2 javax.servlet.jsp jsp-api 2.2 org.glassfish.web el-impl 2.2

And here is my faces-config.xml

<?xml version="1.0" encoding="utf-8"?>
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xi="http://www.w3.org/2001/XInclude" 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-facesconfig_1_2.xsd">

    <application>
        <navigation-handler>de.xxx.jsf.client.navigation.XXXNavigationHandler</navigation-handler>
    </application>
</faces-config>

And here is my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">

    <display-name>JavaServerFaces</display-name>

    <!-- Change to "Production" when you are ready to deploy -->
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.injectionProvider</param-name>
        <param-value>de.xxx.jsf.client.guice.GuiceInjectionProvider</param-value>
    </context-param>

    <!-- Welcome page -->
    <welcome-file-list>
        <welcome-file>faces/hello.xhtml</welcome-file>
    </welcome-file-list>

    <!-- JSF mapping -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- Map these files with JSF -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

</web-app>

Does anyone of you know why the application is crashing?

Thx in advance!

TJ

¿Fue útil?

Solución

Your faces-config.xml header still pointing to 1.2 DTD. This may lead to unpredicatable error. I would suggest update it to 2.0 DTD and try.

<?xml version='1.0' encoding='UTF-8'?>

<faces-config version="2.0"
   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-facesconfig_2_0.xsd">
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top