This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes classloader inversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "classloader inversion" Watch "classloader inversion" New topic
Author

classloader inversion

Paulo Jiang
Greenhorn

Joined: Oct 28, 2011
Posts: 1

Can anybody please explain the following paragraph from "core java volume II 8th edtion" Page 759


/////////////////////////////////

Your application code contains a helper method that calls Class.forName(classNameString).

That method is called from a plugin class.

The classNameString specifies a class that is contained in the plugin JAR.

The author of the plugin has the reasonable expectation that the class should be loaded. However, the helper method's class was loaded by the system class loader, and that is the class loader used by Class.forName. The classes in the plugin JAR are not visible. This phenomenon is called classloader inversion ......

////////////////////////////////


From my understanding, if "the helper method's class was loaded by the system class loader", then the plugin jar it is in must be placed in the CLASSPATH, and also if "The classNameString specifies a class that is contained in the plugin JAR" then these two classes should be both in the same jar file, which is in CLASSPATH, then why "The classes in the plugin JAR are not visible"

 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: classloader inversion
 
It's not a secret anymore!