jsfcdicustom-error-pagesweldconversation-scope

How to configure error page location for NonexistentConversationException?


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?


Solution

  • 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