<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><div>Hi Jörn,</div><div>Thank you a lot a lot :) :) I will try it:)</div><div><hr align="left" style="margin: 0 0 10px 0;border: 0;border-bottom:1px solid #E4E5E6;height:0;line-height:0;font-size:0;padding: 20px 0 0 0;width: 50px;"><div style="font-size:14px;font-family:Verdana;color:#000;"><div><span style="line-height: 1.5;">BR,</span></div><div>Mike(Yu, Chong-Chao)</div></div></div><div> </div><div><div><br></div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ 原始邮件 ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>发件人:</b> "Jörn Huxhorn"<jhuxhorn@googlemail.com>;</div><div><b>发送时间:</b> 2020年6月14日(星期天) 晚上10:42</div><div><b>收件人:</b> "logback users list"<logback-user@qos.ch>;<wbr></div><div></div><div><b>主题:</b> Re: [logback-user] logback does not print exception's cause</div></div><div><br></div>
<style>body{font-family:Helvetica,Arial;font-size:13px;}</style><div style="font-family:Helvetica,Arial;font-size:13px">Hi Mike,</div><div style="font-family:Helvetica,Arial;font-size:13px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px">sorry for the late answer. I hope this still helps you.</div><div style="font-family:Helvetica,Arial;font-size:13px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px">This stackoverflow answer solves your problem:</div><div style="font-family:Helvetica,Arial;font-size:13px"><a href="https://stackoverflow.com/questions/2411487/nullpointerexception-in-java-with-no-stacktrace#3010106">https://stackoverflow.com/questions/2411487/nullpointerexception-in-java-with-no-stacktrace#3010106</a></div><div style="font-family:Helvetica,Arial;font-size:13px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px">TL;DR:</div><div style="font-family:Helvetica,Arial;font-size:13px">You are running into a hotspot optimisation and need to add -XX:-OmitStackTraceInFastThrow to your JVM options to “enable” those stacktraces.</div> <div><br></div>Cheers,<div>Jörn.<br> <div class="gmail_signature"></div> <br><p class="airmail_on">On 10. June 2020 at 04:52:38, 陌路人 (<a href="mailto:h5ru@qq.com">h5ru@qq.com</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div><div dir="auto"><div style="font-family:sans-serif;font-size:13px;white-space:normal">Hi,</div><div style="font-family:sans-serif;font-size:13px;white-space:normal">Firstly thank you for your time.</div><div style="font-family:sans-serif;font-size:13px;white-space:normal">Sometimes, logback does not print exception's cause, I can't use the log to fix bug, as followings:</div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><br></div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><div>2020-06-09 16:54:32,393 ERROR [task-executor-27] [SimpleDispatcher.java:203] Exception occurred during dispatch web socket frame for uri[/ws/partydungeon/move] by uid[‪6493203‬].</div><div>java.lang.reflect.InvocationTargetException: null</div><div><span style="white-space:pre;line-height:1.5">    </span>at sun.reflect.<b><font color="#ff6600">GeneratedMethodAccessor100</font></b>.invoke(Unknown Source)</div><div><span style="white-space:pre;line-height:1.5">        </span>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)</div><div><span style="white-space:pre;line-height:1.5">      </span>at java.lang.reflect.Method.invoke(Method.java:498)</div><div><span style="white-space:pre;line-height:1.5">   </span>at com.mitu.game.dispatcher.SimpleDispatcher$EventRunnable.doWebSocketMessage(SimpleDispatcher.java:187)</div><div><span style="white-space:pre;line-height:1.5">      </span>at com.mitu.game.dispatcher.SimpleDispatcher$EventRunnable.run(SimpleDispatcher.java:106)</div><div><span style="white-space:pre;line-height:1.5">     </span>at com.mitu.game.wrapper.ThreadPoolTaskExecutorEx$SafeRunnable.run(ThreadPoolTaskExecutorEx.java:74)</div><div><span style="white-space:pre;line-height:1.5">  </span>at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)</div><div><span style="white-space:pre;line-height:1.5">    </span>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)</div><div><span style="white-space:pre;line-height:1.5">    </span>at java.lang.Thread.run(Thread.java:748)</div><div>Caused by: java.lang.NullPointerException: null</div><div>2020-06-09 16:54:32,405 INFO [nioEventLoopGroup-3-4] [SimpleLoggingHandler.java:35] IN {uid=‪5589867‬, forward=<a href="https://183.200.25.192/">183.200.25.192</a>, <a href="https://183.200.25.192:24172/">183.200.25.192:24172</a>, type=websocket, uri=/ws/user/bind, ts=‪1591692869‬} /<a href="https://10.0.0.70:34948/">10.0.0.70:34948</a> 10</div></div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><br></div><div style="font-family:sans-serif;font-size:13px;white-space:normal">And the code is like:</div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><div>    private void doWebSocketMessage(Event event) {</div><div>            String uri = "some uri";</div><div>            String uid = "some id";</div><div>            try {</div><div>                Object ret = action.method.invoke(<a href="https://action.in/">action.in</a>stance, event.getData(), new Object[]{event});</div><div>            } catch (Exception ex) {</div><div>                logger.error(String.format("Exception occurred during dispatch web socket frame for uri[%s] by uid[%s].", uri, uid), ex);</div><div>            }</div><div>        }</div></div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><br></div><div style="font-family:sans-serif;font-size:13px;white-space:normal">I tried to look for answers by google and bing, but failed, and I tried to reproduce this problem, failed too, the cause can be printed, and it likes:</div><div style="font-family:sans-serif;font-size:13px;white-space:normal">java.lang.reflect.InvocationTargetException: null</div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><span style="white-space:pre;line-height:1.5">       </span>at sun.reflect.<font color="#ff6600"><b>NativeMethodAccessorImpl</b></font>.invoke0(Native Method)</div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><span style="white-space:pre;line-height:1.5">       </span>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)</div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><span style="white-space:pre;line-height:1.5">   </span>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)</div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><span style="white-space:pre;line-height:1.5">   </span>at java.lang.reflect.Method.invoke(Method.java:498)</div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><span style="white-space:pre;line-height:1.5">        </span>at com.mitu.game.Application.main(Application.java:54)</div><div style="font-family:sans-serif;font-size:13px;white-space:normal">Caused by: java.lang.NullPointerException: null</div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><span style="white-space:pre;line-height:1.5">    </span>at com.mitu.game.Application$T.f(Application.java:42)</div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><span style="white-space:pre;line-height:1.5">      </span>... 5 common frames omitted </div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><br></div><div style="font-family:sans-serif;font-size:13px;white-space:normal">the difference is NativeMethodAccessorImpl vs GeneratedMethodAccessor100, is it matter? I steped into the logback code, maybe the target of the exception is null, but I do not know the reason:(</div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><br></div><div style="font-family:sans-serif;font-size:13px;white-space:normal"><br></div><div style="font-family:sans-serif;font-size:13px;white-space:normal">Thank you again, for your patient, and sorry for my poor english:(</div><br>BR,<div>Mike Yu</div></div>_______________________________________________<br>logback-user mailing list<br><a href="mailto:logback-user@qos.ch">logback-user@qos.ch</a><br><a href="http://mailman.qos.ch/mailman/listinfo/logback-user">http://mailman.qos.ch/mailman/listinfo/logback-user</a></div></div></span></blockquote></div></div>