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)"

原文地址:https://www.cnblogs.com/CnKker/p/7683146.html