使用JSF2查看状态时出错

时间:2013-01-08 19:23:24

标签: jsf-2 primefaces

您好我使用Mojara 2.1.14和Primefaces 3.3.1开发的应用程序出现以下错误。我没有这个来自哪里的提示。请帮忙。我一直试图寻找解决方案已经好几周了。

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
•       at java.lang.String.substring(String.java:1949)
•       at com.sun.faces.renderkit.ServerSideStateHelper.getState(ServerSideStateHelper.java:273)
•       at com.sun.faces.renderkit.ResponseStateManagerImpl.getState(ResponseStateManagerImpl.java:100)
•       at com.sun.faces.application.view.FaceletPartialStateManagementStrategy.restoreView(FaceletPartialStateManagementStrategy.java:353)
•       at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:138)
•       at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
•       at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:531)
•       at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:141)
•       at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
•       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
•       at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
•       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
•       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
•       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
•       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
•       at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
•       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
•       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
•       at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)
•       at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
•       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
•       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
•       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
•       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
•       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
•       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
•       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
•       at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
•       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
•       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
•       at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
•       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
•       at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
•       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
•       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
•       at java.lang.Thread.run(Thread.java:679)

这是我的web.xml

<web-app id="WebApp_ID" version="2.5"
    xmlns="http://java.sun.com/xml/ns/j2ee">
    <filter>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
        <init-param>
            <param-name>thresholdSize</param-name>
            <param-value>2097152</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <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>/faces/*</url-pattern>
    </servlet-mapping>  
    <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
    <!--   <param-value>Development</param-value>   -->
      <param-value>Production</param-value> 
    </context-param> 

    <context-param>
        <param-name>primefaces.THEME</param-name>
        <param-value>bluesky</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>

    <context-param>
        <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
        <param-value>-1</param-value>
    </context-param>

    <context-param>
        <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
        <param-value>true</param-value>
    </context-param>

     <context-param>        
        <param-name>com.sun.faces.COMPRESS_STATE</param-name>
        <param-value>false</param-value>
     </context-param>


    <context-param>
      <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
      <param-value>/META-INF/components.taglib.xml</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>    
    <context-param>
        <param-name>defaultHtmlEscape</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>/WEB-INF/jsf-beans.xml</param-value>
    </context-param>

    <session-config>
        <session-timeout>15</session-timeout>
    </session-config>    

     <security-constraint>
        <web-resource-collection> 
            <url-pattern>/views/*</url-pattern>
            <http-method>GET</http-method>      
        </web-resource-collection>
        <auth-constraint />
    </security-constraint>  
<!--    
    <context-param>
        <param-name>com.sun.faces.numberOfViewsInSession</param-name>
        <param-value>1</param-value>
    </context-param>

    <context-param>
        <param-name>com.sun.faces.numberOfLogicalViews</param-name>
        <param-value>1</param-value>
    </context-param> -->

  </web-app>

感谢您的帮助。

0 个答案:

没有答案