Exception Handling with Seam

Splash Forums PrettyFaces Users Exception Handling with Seam

This topic contains 19 replies, has 3 voices, and was last updated by  enigmasse 9 years, 11 months ago.

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #18152

    enigmasse
    Participant

    When the HttpSession times out, I catch the ViewExpiredException and redirect the user back to the login page. With PrettyFaces added to the project, it appears PrettyFaces is wrapping the exception before being thrown. This makes it difficult to handle exceptions!

    Is there a way for PrettyFaces to pass the exception instead of wrapping it? This will allow me to better handle the root exception (cause). Any other ideas?

    I am am using Seam 2.2.2 and PrettyFaces 3.3.2.

    Here is an example of the exception being thrown by PrettyFaces.

    [#|2012-02-12T11:08:15.362-0500|SEVERE|sun-appserver2.1|javax.enterprise.system.container.web|_ThreadID=20;_ThreadName=httpSSLWorkerThread-80-4;_RequestID=587a651f-e571-458d-b59f-74f6041aaa69;|StandardWrapperValve[default]: PWC1406: Servlet.service() for servlet default threw exception

    com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/main]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:238)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:82)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)

    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)

    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)

    at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:382)

    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)

    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

    Caused by: javax.servlet.ServletException: viewId:/main.seam - View /main.seam could not be restored.

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)

    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:333)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)

    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)

    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:126)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:871)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:558)

    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:490)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:382)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:232)

    ... 30 more

    Caused by: javax.faces.application.ViewExpiredException: viewId:/main.seam - View /main.seam could not be restored.

    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:189)

    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)

    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)

    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)

    ... 48 more

    #22116

    Hey enigmasse,

    no, there is currently no way to change this behavior. PrettyFaces currently wraps all exceptions.

    However I think we could review this behavior. Perhaps it would make sense to simply rethrow ServletExceptions instead of wrapping them. For ServletExceptions this would make sense.

    @lincoln: Thoughts?

    Christian

    #22117

    enigmasse
    Participant

    I saw this thread from 7 months ago: Swallowed in JSF Phase but I am not sure if it is exactly the same topic.

    I see that Seam Catch is mentioned however I don’t know much about it. It appears Seam Catch has been merged with Seam Solder. I don’t want to over-engineering for one specific scenario I am encountering.

    #22118

    I recommend to simply create a filter that catches both ServletExceptions and PrettyExceptions. If the ServletException wraps a ViewExpiredException or if the PrettyException wraps a ServletException wrapping a ViewExpiredException you do the redirect. This should be pretty simply. However we will discuss if it makes sense to simply rethrow ServletExceptions so that they aren’t wrapped any more.

    #22119

    I thought that we removed the wrapping behavior. If not, we certainly should do so. Wrapping exceptions is bad IMO.

    #22120

    Yeah, that was my thought to. I’ll remove the wrapping of ServletExceptions. I think it’s really bad behavior.

    #22121

    I just fixed this in the 3.x branch. You could give the latest snapshots a try.

    https://github.com/ocpsoft/prettyfaces/wiki/Snapshots

    I think we will release 3.3.3 very soon, so it is safe to use the snapshots! :)

    #22122

    enigmasse
    Participant

    It looks like Feb 12th is the latest snapshot (http://ocpsoft.com/repository/com/ocpsoft/prettyfaces-jsf12/3.3.3-SNAPSHOT/). Is the fix in there?

    Ironically I just finished writing an unwrap filter when I decided to check the forum! I’ll use the snapshot and verify it is resolved so I can help test.

    #22123

    Hmmm. Thank you for bringing this up. Seems like the snapshots aren’t deployed automatically any more.

    @lincoln: Seems like Jenkins doesn’t poll the GitHub repository any more. There have been commits recently but Jenkins’ last build was about 2 weeks ago.

    #22124

    Checking into this. You’re right…

    #22125

    The snapshots are back. Thanks Lincoln.

    Could you give prettyfaces-jsf12-3.3.3-20120216.063413-17.jar a try?

    #22126

    enigmasse
    Participant

    It works! The Servlet errors are no longer wrapped.

    I am still having an issue though. When I add PrettyFaces to my Seam/Richfaces project, Seam doesn’t handle the exception anymore. I believe the breaking combination is an expired session, an ajax request and PrettyFaces.

    This is a stack trace before adding a PrettyFaces Processor (notice only one logged exception):

    [#|2012-02-16T10:38:50.161-0500|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=16;_ThreadName=httpSSLWorkerThread-80-1;|228188 [httpSSLWorkerThread-80-1] ERROR org.jboss.seam.exception.Exceptions - handled and logged exception

    javax.servlet.ServletException: viewId:/main.seam - View /main.seam could not be restored.

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)

    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:333)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:530)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)

    at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)

    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

    at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)

    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

    at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)

    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

    at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)

    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)

    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)

    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)

    at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)

    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

    at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)

    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)

    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)

    at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:382)

    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)

    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

    Caused by: javax.faces.application.ViewExpiredException: viewId:/main.seam - View /main.seam could not be restored.

    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:189)

    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)

    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)

    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)

    ... 51 more

    |#]

    Then I add a PrettyFaces processor that modifies the URL, conduct the same test and here is the new stack trace (throws 3 exceptions):

    [#|2012-02-16T10:22:06.638-0500|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=19;_ThreadName=httpSSLWorkerThread-80-2;|148843 [httpSSLWorkerThread-80-2] ERROR org.ajax4jsf.webapp.BaseXMLFilter - Exception in the filter chain

    javax.servlet.ServletException: viewId:/main.seam - View /main.seam could not be restored.

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)

    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:333)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)

    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)

    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:133)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:871)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:558)

    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:490)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:382)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:236)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:85)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)

    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)

    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)

    at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:382)

    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)

    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

    Caused by: javax.faces.application.ViewExpiredException: viewId:/main.seam - View /main.seam could not be restored.

    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:189)

    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)

    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)

    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)

    ... 48 more

    |#]

    [#|2012-02-16T10:22:06.639-0500|SEVERE|sun-appserver2.1|javax.enterprise.system.container.web|_ThreadID=19;_ThreadName=httpSSLWorkerThread-80-2;_RequestID=6bb84a57-4710-43fe-a214-559b845b3b64;|ApplicationDispatcher[] PWC1231: Servlet.service() for servlet Faces Servlet threw exception

    javax.faces.application.ViewExpiredException: viewId:/main.seam - View /main.seam could not be restored.

    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:189)

    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)

    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)

    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)

    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:333)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)

    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)

    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:133)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:871)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:558)

    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:490)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:382)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:236)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:85)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)

    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)

    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)

    at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:382)

    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)

    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

    |#]

    [#|2012-02-16T10:22:06.640-0500|SEVERE|sun-appserver2.1|javax.enterprise.system.container.web|_ThreadID=19;_ThreadName=httpSSLWorkerThread-80-2;_RequestID=6bb84a57-4710-43fe-a214-559b845b3b64;|StandardWrapperValve[default]: PWC1406: Servlet.service() for servlet default threw exception

    javax.faces.application.ViewExpiredException: viewId:/main.seam - View /main.seam could not be restored.

    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:189)

    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)

    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)

    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)

    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:333)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)

    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)

    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:133)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:871)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:558)

    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:490)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:382)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:236)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:85)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)

    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)

    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)

    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)

    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)

    at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:382)

    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)

    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

    |#]

    If the session is expired and you click a regular link, it works without a problem and Seam catches the ViewExpiredException. If you click on an AJAX link after the session is expired, I get the multiple exceptions and Seam doesn’t catch it.

    I looked at the PrettyFilter.java:236 and this is the line: “req.getRequestDispatcher(newUrl).forward(req, resp);”. If I create a basic processor and just return the incoming URL, it works. But if I modify the URL in any way in the Processor, it breaks with the above exceptions.

    Just to recap, it is only with AJAX requests with an expired session using PrettyFaces with a Processor. If I put a basic Processor in place (same inbound as outbound), only one exception is thrown and expected. If I modify the URL in the Processor, I get a multiple exceptions when I was hoping for just that one exception so Seam can catch it.

    Do you have any ideas?

    #22127

    enigmasse
    Participant

    Here is the filters in my Web.xml

    <!-- Used for url rewriting -->

    <filter>

    <filter-name>Pretty Filter</filter-name>

    <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>

    </filter>

    <filter-mapping>

    <filter-name>Pretty Filter</filter-name>

    <url-pattern>/*</url-pattern>

    <dispatcher>FORWARD</dispatcher>

    <dispatcher>REQUEST</dispatcher>

    <dispatcher>ERROR</dispatcher>

    </filter-mapping>

    <!-- Defining and mapping the RichFaces filter -->

    <filter>

    <display-name>RichFaces Filter</display-name>

    <filter-name>Richfaces Filter</filter-name>

    <filter-class>org.ajax4jsf.Filter</filter-class>

    </filter>

    <filter-mapping>

    <filter-name>Richfaces Filter</filter-name>

    <servlet-name>Faces Servlet</servlet-name>

    <dispatcher>REQUEST</dispatcher>

    <dispatcher>FORWARD</dispatcher>

    <dispatcher>INCLUDE</dispatcher>

    </filter-mapping>

    <filter>

    <filter-name>Seam Filter</filter-name>

    <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>

    </filter>

    <filter-mapping>

    <filter-name>Seam Filter</filter-name>

    <url-pattern>/*</url-pattern>

    </filter-mapping>

    #22128

    It looks like it’s the same exception but it’s logged more than once by the different filters that the request passes thought. So actually, this shouldn’t be a problem as the exception is only thrown once. IMHO it’s just some noise in the logs.

    #22129

    enigmasse
    Participant

    I don’t understand that when PrettyFaces modifies the URL, then I get the noise and when it doesn’t modify the URL, I get the nice clean exception (all while the session is expired and ONLY for AJAX requests). For some reason with the log noise, somewhere along the line Seam isn’t catching the exception.

    If I take out the PrettyFaces filter and complete the same scenario, its a nice clean exception! I don’t see why adding PrettyFaces should change the way the logs look.

    I am having a hard time getting my head wrapped around this!

Viewing 15 posts - 1 through 15 (of 20 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.