Thread.getContextClassLoader() is null

Java threads created from JNI code in a non-java thread have null ContextClassloader unless the creator explicitly sets it.

Also in such context Thread.currentThread() returns null.

This can be fixed by setting "ClassLoader cl = ClassLoader.getSystemClassLoader()" instade of "Thread.currentThread().setContextClassLoader(cl)"

 

posted @ 2017-10-17 18:07  cnkker.com  阅读(823)  评论(0编辑  收藏  举报