3

我正在尝试将我的应用程序从 jsf 1.2 迁移到 2.1。我写了一个示例 facelet 页面并尝试访问它。得到以下异常。不知道是什么导致了这个问题。如果仅执行此页面(通过删除与我的项目相关的所有代码和库,此页面将正确呈现)。关于可能导致此问题的任何帮助都会非常有帮助。

Servlet.service() for servlet Faces Servlet threw exception: java.lang.IllegalStateException: Header count exceeded allowed maximum: 128
    at org.apache.tomcat.util.http.MimeHeaders.createHeader(MimeHeaders.java:329) [jbossweb-7.0.10.Final.jar:]
    at org.apache.tomcat.util.http.MimeHeaders.addValue(MimeHeaders.java:347) [jbossweb-7.0.10.Final.jar:]
    at org.apache.coyote.Response.addHeader(Response.java:351) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.connector.Response.addHeader(Response.java:1110) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.connector.ResponseFacade.addHeader(ResponseFacade.java:502) [jbossweb-7.0.10.Final.jar:]
    at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:202) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
    at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:202) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
    at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:202) 
    at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:202) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
    at javax.servlet.http.HttpServletResponseWrapper.addHeader(HttpServletResponseWrapper.java:202) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
    at com.sun.faces.context.ExternalContextImpl.<init>(ExternalContextImpl.java:137) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.context.ExternalContextFactoryImpl.getExternalContext(ExternalContextFactoryImpl.java:73) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:93) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:583) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [jbossweb-7.0.10.Final.jar:]
    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:546) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:364) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
4

2 回答 2

4

此问题与 faces-config.xml 有关。标题应该是。

<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">
于 2012-04-18T18:55:31.513 回答
-1

在你的 head 元素中包含这个标签,如下所示:

<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</h:head>

维基上的解释

于 2012-04-14T20:30:20.940 回答