报错信息堆栈里不包含具体原因

最近在外网看项目日志发现有些error堆栈都一样,但是调用的入口不同

比如

com.jfinal.core.ActionHandler - /wap/payment/paymentNotify
com.jfinal.core.ActionException
	at com.jfinal.core.Controller.renderError(Controller.java:1173)
	at com.jfinalshop.interceptor.AjaxInterceptor.intercept(AjaxInterceptor.java:43)
	at com.jfinal.aop.Invocation.invoke(Invocation.java:67)
	at com.github.jieblog.plugin.shiro.core.ShiroInterceptor.intercept(ShiroInterceptor.java:97)
	at com.jfinal.aop.Invocation.invoke(Invocation.java:67)
	at com.jfinal.core.ActionHandler.handle(ActionHandler.java:74)
	at com.jfinal.plugin.druid.DruidStatViewHandler.handle(DruidStatViewHandler.java:75)
	at com.jfinal.ext.handler.FakeStaticHandler.handle(FakeStaticHandler.java:58)
	at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)

怀疑是全局拦截器导致的,我有两个全局拦截器一个是AjaxIntecptor一个是shiro

我想问

  1. 这种总是报ActionException的错误而没有具体的causeBy是因为全局拦截器把错误吃掉了吗

  2. 有什么办法可以解决类似的问题,或者我哪里处理的不好会导致这种情况的发生,这种error基本都没什么参考价值了我都不知道哪里报的

评论区

JFinal

2017-12-17 21:50

1:某些异常本身就没有 cause 部分,也不需要 cause 部分,例如空指针异常 NullPointerException。你可以认为这些异常已经清晰到无法再做进一步的解释

2:JFinal 的 ActionHandler 中会对所有捕获到的异常做做一次日志,如果不希望在这里被做一次日志,需要你自己 try catch 后,不再 throw 抛出来即可。 你有两个全局拦截器,需要检查一下是不是 catch 中没有 catch 到所有可能的异常类型,以及是否再次抛出

热门反馈

扫码入社