jeudi 19 février 2015

Spring MVC exception handler doesn't work with additional custom interceptor

I have one Spring MVC controller, and I intercept all the controller method with AOP in XML file to monitor the execution time. With this customer AOP, I find that the ExceptionHandler can not work. it always return http code 200 and has this error message:



"XML Parsing Error: no element found Location: moz-nullprincipal".


Below is my AOP configuration and the ExceptionHandler method


AOP configuration:



<aop:config>
<aop:pointcut id="commonPointcut"
expression="execution(* com.xxx.xxx.controller.*.*(..))" />
<aop:advisor pointcut-ref="commonPointcut" advice-ref="multiTenantInterceptor" />
<aop:advisor pointcut-ref="commonPointcut" advice-ref="executionTimeInterceptor" />
</aop:config>


ExceptionHandler:



@ExceptionHandler(MyException.class)
public ModelAndView exp(MyException ex) {

ModelAndView model = new ModelAndView("error");
model.addObject("message", ex.getMessage());
return model;
}


Is there anything wrong? Thanks.


Aucun commentaire:

Enregistrer un commentaire