4

I need help handling the expired/non-existent conversation when ?cid=XX is in the URL. I have tried to put

<error-page>
    <exception-type>org.jboss.weld.context.ContextNotActiveException</exception-type>
    <location>/faces/index.xhtml</location>
</error-page>
<error-page>
    <exception-type>org.jboss.weld.context.NonexistentConversationException</exception-type>
    <location>/faces/index.xhtml</location>
</error-page>

However these didn't work. I still get the error and couldn't forward to index.xhtml. How can I solve this problem?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Yangrui
  • 1,217
  • 2
  • 17
  • 41

2 Answers2

4

You have to to explicitly specify that a conversation shouldn't be propagated for a particular request. Add nocid=true as a parameter at the end of your index.xhtml.

<error-page>
    <exception-type>org.jboss.weld.context.NonexistentConversationException</exception-type>
    <location>/faces/index.xhtml?nocid=true</location>
</error-page>

Refer to the following link expired conversations involving CDI and JSF

Addison
  • 7,322
  • 2
  • 39
  • 55
udaykiran.nalla
  • 109
  • 1
  • 15
2

The ancester to the weld exception works in web.xml:

<error-page>
    <exception-type>javax.enterprise.context.NonexistentConversationException</exception-type>
    <location>/index.xhtml?nocid=true</location>
</error-page>
  • This is true for Wildfly 12 and 13. If you are using Wildfly 10 or 11 the exception type "org.jboss.weld.context.NonexistentConversationException" should be chosen. – Ralph Aug 04 '18 at 22:51