Pergunta

I have following are defined in seam's pages.xml

<page view-id="/view/Error.xhtml">
    <end-conversation before-redirect="true" root="true" />
</page>
<exception class="my.custom.exceptions.exception.BaseException">
    <redirect view-id="/view/Error.xhtml">
        <message severity="FATAL">Please contact system administrator.</message>
    </redirect>
</exception>

And following filter in web.xml

<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>

I've also disabled Facelets development mode in web.xml and Seam debug mode in components.xml

And in the user insert service class, I throws exception like following:

if(true) {throw new BaseException();}

However, it just print the BaseException at console instead of redirecting to error page. The page is still at user insert page. What am I doing wrong?

Edit: I've also tried annotations based exception handling. Here's the code.

@Redirect(viewId="/view/Error.xhtml", message="Unexpected error")
public class BaseException extends MyOwnRuntimeException {

Except from exceptions , other page redirections defined in pages.xml are working properly.

Foi útil?

Solução

Updated JBoss Seam library from version 2.3.0Final to 2.3.1Final and the problem is solved. Didn't even need to disable Facelets development mode and Seam debug mode even though Jboss doc said:

You need to disable Facelets development mode in web.xml and Seam debug mode
in components.xml if you want your exception handlers to fire. 
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top