Java – when thread currentThread(). What happens when getcontextclassloader () returns null?

Start with the jar file containing the Jax - WS SPI text file in / meta - inf, and then the class it points to Put it in the classpath Set the contextclassloader of the current thread to null

Call the service class from the Jax - WS API in JDK 1.6, and then start to execute it step by step Without a context class loader, this code will call the static method of class to find the content

It will successfully find the SPI file But it couldn't find its name class.

If you really want to try it yourself, grab Apache CXF 2.2 10. Put it on the classpath and empty the context classloader

This is not a meaningless masochistic exercise: it turns out that when open office calls the Java extension ('uno '), it makes the context class loader null Some important rectal archaeology is needed to solve this problem This makes me wonder if there is a JDK error explaining inconsistent results, or some specified behavior that I don't understand?

Solution

Various errors have been made for such events; For example, scan the results of this query The general sun response is that these functions are not errors and will not be repaired; For example http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4155645.

The bottom line is that getcontextclassloader can return null

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>