struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shanku <>
Subject Issue with custom ExceptionMappingInterceptor
Date Fri, 24 Jul 2009 16:05:16 GMT

I have implemented a custom ExceptionMappingInterceptor. The custom
interceptor basically handles all the business exceptions thrown by the
service method. The one that implemented is getting executed fine whenever a
exception is throw however on broswer i cant see the same page and error
msg, where as i see the stack trace of exception...
I can see all the sysout messages on my console.
Please help me.

public class MyExceptionInterceptor extends ExceptionMappingInterceptor {
        protected void publishException(ActionInvocation actionInvocation,
                        ExceptionHolder exceptionHolder) {
                super.publishException(actionInvocation, exceptionHolder);
                // ActionContext invocationContext = actionInvocation
                // .getInvocationContext();
                if (exceptionHolder.getException() instanceof
MyBusinessException) {
                        MyBusinessException mecoBusinessException =
(MyBusinessException) exceptionHolder.getException();
                        Object action = actionInvocation.getAction();
                 System.out.println("*********** instanceof
MyBusinessException ******* ");             
                        if (action instanceof ValidationAware) {
                  System.out.println("****** instanceof ValidationAware
******** ");                                    
                                ValidationAware va = (ValidationAware)
                                String key =
                                String message = "";
                   System.out.println("********KEY: "+key);
                                if (actionInvocation.getAction() instanceof
ActionSupport) {
                                System.out.println("******** instanceof
ActionSupport ******* ");       
                                        message = ((ActionSupport)
                        System.out.println("******* instanceof ActionSupport
message*** "+message);                                             
                                } else {
                                        message = key;
                                // va.addActionError(message);
                                va.addActionError("INTERCEPTOR CALLED TO
System.out.println("************************** end publishException
my struts config:
<interceptor name="myExceptionInterceptor"
                        <interceptor-stack name="myExceptionStack">
                                <interceptor-ref name="defaultStack" />
name="myExceptionInterceptor" />
<default-interceptor-ref name="myExceptionStack" />

Thanks in advance

View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message