我目前正在开发一个 Web 应用程序。我在 tomcat 6 上使用 JSF 2。一切都很好,但现在我想浏览我的页面......(我决定做一个无 XML 的 JSF 导航方法)。为此,我需要添加一个 faces-config.xml。我做到了,但是在添加 faces-config 之后,当我想打开我的页面时总是会出错。
SCHWERWIEGEND: Servlet.service() for servlet Faces Servlet threw exception
java.lang.StackOverflowError
at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:216)
...
如果我删除 faces-config 一切都很好(但是我没有导航:()。
这是我的 Maven 依赖项: 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
这是我的 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>
这是我的 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>
你们中有人知道为什么应用程序崩溃了吗?
提前谢谢!
TJ