<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><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>