1

My environment is: NetBeans7.2.1, GlassFish3.1, JSF2 and Weld 1.1.0.

When the conversation time expires, I would like to redirect to error.xhtml page. Inside web.xml I added this code:

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

But then I get this exception error:

WARNING: org.apache.catalina.core.StandardHostValve@365f4aa6: Exception Processing ErrorPage[exceptionType=org.jboss.weld.context.NonexistentConversationException, location=/error.xhtml]
javax.servlet.ServletException: WELD-000321 No conversation found to restore for id 1

When I use Servlet Listener named ErrorHandler to catch this exception with this code inside the web.xml:

<error-page>
    <exception-type>org.jboss.weld.context.NonexistentConversationException</exception-type>
    <location>/ErrorHandler</location>
</error-page>

It works fine, and I'm redirecting to error.xhtml from there.

I need the location to work directly throgh the web.xml (and not thriugh the servlet).

I tried changing the xhtml page to html , it still did not work but the exception was diffrent:

WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces     Servlet threw exception
 org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 1

I also tried changing the root of the location to /faces/error.xhtml , and it still did not work.

What could be the problem? How can I redirect to a page from the web.xml ?

Thank's In Advance.

user2046810
  • 393
  • 1
  • 8
  • 21

1 Answers1

0

You need to add nocid parameter to the URL because the reason for your error is that CDI is sending non-existing conversation id to the error.xhtml page. So try following

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

More info here

Petr Mensik
  • 26,874
  • 17
  • 90
  • 115
  • this is the error: `WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 1` – user2046810 Oct 23 '13 at 09:19
  • Wow, then I don' know, this is exactly what `nocid` param is supposed to prevent – Petr Mensik Oct 23 '13 at 09:27
  • even if `error.xhtml` does not use the conversation ? any idea what can cause this ? it's seems that it cannot find the page, i have no idea why..... – user2046810 Oct 23 '13 at 09:33