Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thread.getContextClassLoader() == null?

Can Thread.getContextClassLoader() be null ? The javadoc is not really clear.
Should a library take this case into account ?

Update: the reason I asked is that beansbinding.dev.java.net does not work in this case (and my code does setContextClassLoader(null)

like image 235
Tom Avatar asked Oct 22 '08 12:10

Tom


1 Answers

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.

like image 55
2 revs Avatar answered Sep 23 '22 11:09

2 revs