<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body><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></body></html>