random java.lang.NullPointerException导致java.lang.IllegalStateException:PWC1227:响应提交后无法转发

时间:2014-10-16 21:49:07

标签: jsf

有些时候我们得到java.lang.IllegalStateException后发生了几个java.lang.NullPointerException,如下面的应用程序所示,它是JBoss seam,JSF和EJB应用程序

如果发生以下少数异常

2014-10-16 11:12:17,881 ERROR Unexpected Exception Logged java.lang.NullPointerException
    at com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectionKeyHandler$CloseHandler.notifyClosed(MonitorableSelectionKeyHandler.java:94)
    at com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectionKeyHandler$CloseHandler.remotlyClosed(MonitorableSelectionKeyHandler.java:90)
    at com.sun.grizzly.BaseSelectionKeyHandler.notifyRemotlyClose(BaseSelectionKeyHandler.java:233)
    at com.sun.grizzly.util.OutputWriter.notifyRemotelyClosed(OutputWriter.java:353)
    at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:148)
    at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:76)
    at com.sun.grizzly.http.SocketChannelOutputBuffer.flushChannel(SocketChannelOutputBuffer.java:326)
    at com.sun.grizzly.http.SocketChannelOutputBuffer.flushBuffer(SocketChannelOutputBuffer.java:398)
    at com.sun.grizzly.http.SocketChannelOutputBuffer.endRequest(SocketChannelOutputBuffer.java:389)
    at com.sun.grizzly.http.ProcessorTask.action(ProcessorTask.java:1090)
    at com.sun.grizzly.tcp.Response.action(Response.java:268)
    at com.sun.grizzly.tcp.Response.finish(Response.java:412)
    at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:341)
    at org.apache.catalina.connector.CoyoteOutputStream.close(CoyoteOutputStream.java:187)
    at java.nio.channels.Channels$WritableByteChannelImpl.implCloseChannel(Channels.java:469)
    at java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:115)
    at com.sun.faces.application.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:296)
    at org.richfaces.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:259)
    at javax.faces.application.ResourceHandlerWrapper.handleResourceRequest(ResourceHandlerWrapper.java:125)
    at org.apache.myfaces.custom.captcha.CAPTCHAResourceHandlerWrapper.handleResourceRequest(CAPTCHAResourceHandlerWrapper.java:208)
    at javax.faces.application.ResourceHandlerWrapper.handleResourceRequest(ResourceHandlerWrapper.java:125)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:591)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:327)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)

然后得到以下异常,

2014-10-16 11:12:10,048 ERROR Unexpected Exception Logged: /error.jsf
java.lang.IllegalStateException: PWC1227: Cannot forward after response has been committed
    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:370)
    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)
    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:546)
    at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)
    at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)
    at org.jboss.seam.faces.environment.org$jboss$weld$bean-WEB-INF$lib$seam-faces-3$1$0$Final-ManagedBean-class_org$jboss$seam$faces$environment$SeamExternalContext_$$_WeldClientProxy.dispatch(org$jboss$weld$bean-WEB-INF$lib$seam-faces-3$1$0$Final-ManagedBean-class_org$jboss$seam$faces$environment$SeamExternalContext_$$_WeldClientProxy.java)
    at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:364)
    at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
    at org.jboss.seam.faces.view.SeamViewDeclarationLanguage.buildView(SeamViewDeclarationLanguage.java:81)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:787)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:534)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:469)
    at org.apache.catalina.core.StandardHostValve.dispatchToErrorPage(StandardHostValve.java:673)
    at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:298)
    at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:220)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:656)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:327)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)

这是我的面部上下文文件和web.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is not required if you don't need any extra configuration. -->
<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">
    <application>
        <message-bundle>ErrorMessages</message-bundle>
        <resource-bundlErrorMessages</base-name>
            <var>msgs</var>
        </resource-bundle>        
    </application>        
</faces-config>


    <?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_3_0.xsd"
             version="3.0">
        <listener>
            <listener-class>com.clss.base.session.SessionListener</listener-class>
        </listener>
        <filter>
            <filter-name>SessionFilter</filter-name>
            <filter-class>com.clss.base.session.SessionFilter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>SessionFilter</filter-name>
            <url-pattern>/home/*</url-pattern>
        </filter-mapping>
        <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>*.jsf</url-pattern>
        </servlet-mapping>
        <context-param>
            <param-name>facelets.DEVELOPMENT</param-name>
            <param-value>false</param-value>
        </context-param>
        <context-param>
            <param-name>org.richfaces.fileUpload.createTempFiles</param-name>
            <param-value>true</param-value>
        </context-param>
        <context-param>
            <param-name>org.richfaces.fileUpload.maxRequestSize</param-name>
            <param-value>1073741824</param-value>
        </context-param>
        <context-param>
            <param-name>org.richfaces.enableControlSkinning</param-name>
            <param-value>false</param-value>
        </context-param>
        <context-param>
            <param-name>com.sun.faces.sendPoweredByHeader</param-name>
            <param-value>false</param-value>
        </context-param>
        <session-config>
            <session-timeout>30</session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>login.jsf</welcome-file>
        </welcome-file-list>
        <error-page>
            <location>/error.jsf</location>
        </error-page>
    </web-app>

0 个答案:

没有答案