[英]faces-config leads to exception on startup web application
I'm developing a web application at the moment. 我正在开发一个Web应用程序。 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 ). 我在tomcat 6上使用JSF 2.一切都很好,但现在我想浏览我的页面......( 我决定采用无XML的JSF导航方法 )。 For this I need to add a faces-config.xml. 为此,我需要添加faces-config.xml。 I did it, but after adding the faces-config I always get an error when I want to open my page. 我做到了,但是在添加了faces-config之后,当我想打开我的页面时,我总是遇到错误。
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 :( ). 如果我删除faces-config一切都很好(但后来我没有导航:()。
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 这是我的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
And here is my faces-config.xml 这是我的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 这是我的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! Thx提前!
TJ TJ
Your faces-config.xml header still pointing to 1.2 DTD. 您的faces-config.xml标头仍然指向1.2 DTD。 This may lead to unpredicatable error. 这可能会导致不可预测的错误。 I would suggest update it to 2.0 DTD and try. 我建议将其更新为2.0 DTD并尝试。
<?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">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.