This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes How to handle CDI Conversation expired in JBoss 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "How to handle CDI Conversation expired in JBoss 7" Watch "How to handle CDI Conversation expired in JBoss 7" New topic
Author

How to handle CDI Conversation expired in JBoss 7

Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2841
    
  11

I'm deploying a web application implemented with JSF to JBoss AS 7.1.0. Recently, I started using CDI, as implemented by JBoss WELD, primarily because of the conversation scope. However, when a conversation times out, the next page access causes a 500 page to be displayed with a stack trace. The root cause is:

Caused by: org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 2

This exception seems to bypass both the rule setup in web.xml to handle it ...


... as well as the general rule for 500 server errors.



If it can't do better exception handling than this, then the conversation scope of WELD would be worthless, so I'm assuming there must be a way.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

Not fully sure, but is that exception nested within some other exception? Could you please post that entire exception stacktrace, that might give a hint? Having said that I don't know why it bypasses the 500 error code page.

[My Blog] [JavaRanch Journal]
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2841
    
  11

Sure, here's what I'm getting in my browser, followed by what shows up in the JBoss console.




15:20:01,168 ERROR [org.apache.catalina.core.ContainerBase.[default-host]] (http--0.0.0.0-8443-5) Exception Processing ErrorPage[exceptionType=org.jboss.weld.context.NonexistentConversationException,
location=/home.jsf]: javax.servlet.ServletException: WELD-000321 No conversation found to restore for id 2
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) [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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [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:543) [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 org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:533) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:387) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:278) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:459) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 2
at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:221) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:118) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:85) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
... 26 more
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

There's an interesting part in that log:

15:20:01,168 ERROR [org.apache.catalina.core.ContainerBase.[default-host]] (http--0.0.0.0-8443-5) Exception Processing ErrorPage[exceptionType=org.jboss.weld.context.NonexistentConversationException, location=/home.jsf]


So it looks like it is trying to render a error-page for that exception but failing to do so. A few things that stand out are:

1) For some reason it's trying to use /home.jsf as the error page for that exception type instead of the expired.jsf that you configured. Perhaps the config that you posted was just a dummy?
2) Instead of using JSF in the error pages, I would just try a plain HTML page first without too many things in it to see if that works. If it does, then it's a matter to figuring out why JSF views don't work in an error page.


Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

Jaikiran Pai wrote:If it does, then it's a matter to figuring out why JSF views don't work in an error page.


Maybe the error page itself is relying on a conversational state and failing because of a non-existing conversation?
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2841
    
  11

Hi Jaikiran,

I really appreciate your helping me with this. You're absolutely right that I had the error handler pointing back to /home.jsf rather than /expired.jsf and I was altered the posted web.xml to make what I thought was a cleaner example.

With your suggestions, I've tried this:

1. Created an expired.html and set the error handler in web.xml to redirect to that. Result: success! The page displays when an invalid conversation is hit.
2. Renamed expired.html to expired.jsp and updated web.xml. Result: success.
3. Renamed expired.jsp to expired.xhtml and altered the head tag to h:head and body tag to h:body, but otherwise didn't change anything. Updated web.xml with /expired.jsf. Result: failure. Similar stack trace to before.



So what I'm thinking is the cid parameter gets passed on to any JSF even in the case where the JSF is trying to handle an invalid conversation. The thing is, I'd really like to have a JSF page handling this exception. There must be a way to convince it to drop the cid parameter before trying to render the expired page.

Also, I don't know if this matters, but the JBoss console actually shows six of these stack traces each time the exception occurs. Only the last of the six show the view id (now truly /expired.jsf, previously /home.jsf). Could this be connected to the six phase life cycle of JSF? The coincidence of the number 6 is all I'm basing that theory on.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

This does look like a JSF (implementation?) issue. I remember seeing some threads where users had issues with using JSF pages for error pages. I can't seem to find that thread or reference right now. As for the exception repeating 6 times, can you post the entire stacktrace?
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2841
    
  11

That's probably a good idea, since now that I look at it again, there's only five stack traces. Did I miscount before? Weird. There's also some differences among them, and a couple do reference JSF life cycle phases.

As for previous threads, there's a number referring to an early WELD bug that made these exceptions appear as NPEs. That seems to have been fixed. Most of the others I've found are with Glassfish, not JBoss, including this one on tracker https://issues.jboss.org/browse/WELD-554 . The reporter seems to be having a similar problem to mine, but claims that a clean build fixed it (!), and so the issues was closed without action.

There's another at https://issues.jboss.org/browse/WELD-855, but it's related to both Glassfish and Seam Catch, so it might not be relevant to what I'm doing.

Stack traces follow.


11:32:09,080 ERROR [org.ajax4jsf.webapp.BaseXMLFilter] (http--0.0.0.0-8443-2) Exception in the filter chain: javax.servlet.ServletException: WELD-000321 No conversation found to restore for id 1
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) [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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
at xxx.obfuscated.package.IE8FixServlet.doFilter(IE8FixServlet.java:28) [classes:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [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.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) [jbossweb-7.0.10.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:278) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:459) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 1
at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:221) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:108) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:85) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
... 30 more

11:32:09,173 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ProviderOrderEntry].[Faces Servlet]] (http--0.0.0.0-8443-2) Servlet.service() for servlet Faces Servlet threw ex
ception: org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 1
at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:221) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:108) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:85) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
at mil.mhs.tc2.poe.servlets.IE8FixServlet.doFilter(IE8FixServlet.java:28) [classes:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [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.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) [jbossweb-7.0.10.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:278) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:459) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]

11:32:09,298 ERROR [org.ajax4jsf.webapp.BaseXMLFilter] (http--0.0.0.0-8443-2) Exception in the filter chain: javax.servlet.ServletException: WELD-000321 No conversation found to restore for id 1
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) [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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [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:543) [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 org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:533) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:387) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:278) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:459) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 1
at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:221) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:118) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:85) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
... 26 more

11:32:09,376 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ProviderOrderEntry].[Faces Servlet]] (http--0.0.0.0-8443-2) Servlet.service() for servlet Faces Servlet threw ex
ception: org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 1
at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:221) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:118) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:85) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [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:543) [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 org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:533) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:387) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:278) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:459) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]

11:32:09,454 ERROR [org.apache.catalina.core.ContainerBase.[default-host]] (http--0.0.0.0-8443-2) Exception Processing ErrorPage[exceptionType=org.jboss.weld.context.NonexistentConversationException,
location=/expired.jsf]: javax.servlet.ServletException: WELD-000321 No conversation found to restore for id 1
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) [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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [richfaces-impl-jsf2-3.3.3.Final.jar:3.3.3.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [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:543) [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 org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:533) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:387) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:278) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:459) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 1
at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:221) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:118) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:85) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final]
... 26 more
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

This looks like something that's so basic that this should have worked but apparently isn't. So I just went through the Weld implementation and found that one way to get past this is to not propagate the conversation id to the error page. One way to do that is include a request parameter named "nocid" in your (JSF) error page (a hidden field for example):



The relevant JIRAs for this "nocid" are

https://issues.jboss.org/browse/CDI-135
https://issues.jboss.org/browse/WELD-919

I admit that those JIRAs aren't in context of this use case but I think this "nocid" might help you get past this issue. Give it a try and let's see how it goes.
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2841
    
  11

Awesome, Jaikiran! I don't think I ever would have found my way to those particular JIRAs. Even so, it took a bit of hit-and-miss to reach a solution. Your idea to put the parameter into a hidden field of the error page was good, but doesn't put it into the parameter map unless the form from the error page is submitted, and the problem is getting it to display in the first place.

Digging into Pete's pull request for CDI-135 seems to say that he's implemented the parameter as "conversationPropapation=none":


<para>When no conversation is propagated to a Servlet request, or if a
GET request parameter named <literal>conversationPropagation</literal>
has the value <literal>none</literal> the request is associated with a
new transient conversation.</para>


Well, that didn't work either, so I went back to nocid, and tried putting it directly into web.xml. That finally worked. So the solution is to define the error handler this way.

web.xml (exerpt)


That should work in Weld from 1.1 onwards. I believe JBoss 7.1.0 contains Weld 1.1.5.

I would think anyone using CDI conversations would need to handle expired ones, and so would run up against this issue. I'm sort of surprised there's so little discussion of it. Hopefully, anyone else that hits it will find their way to this thread.

Thanks again for your help!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

Glad to know that you got it working. I'm surprised too that there's isn't much discussion about this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to handle CDI Conversation expired in JBoss 7
 
Similar Threads
Displaying a Default Error page
Why is my error page not invoked?
web.xml and error-page
error-page!!!
Error Page Problem