解决方案 »

  1.   

    这好像是struts2.3.20版本的问题,虽然错误信息我可以通过log4j显示出来,但现在发现全局异常设置也不起作用了,这个return值是多少没有关系,因为
    admin = null;
    admin.getAccount().toString();
    这一步肯定会报空指针异常,不会再走下去
      

  2.   

    谢谢,这确实是struts2.3.20的Bug https://issues.apache.org/jira/browse/WW-4433  
    里面还提供了一个解决方案
    We've created our own UnknownHandler implementation that just throws a new NoSuchMethodException, allowing DefaultActionInvocation to re-throw the original exception so that our error interceptor can again catch it.他上面这个我不知道怎么用,因为时间问题就不去研究了,如果用spring aop管理异常,则能忽视这Bug
    如果想用struts2管理异常,则应该要用上面英文的方法,或等到2.3.22及以上的版,或用回2.3.16.3及以下的版