Sounds like a class loader hierarchy issue. I cannot determine in which environment your application is deployed, but sometimes this problem can occur in a web environment - where the application server creates a hierarchy of class loaders that resembles something like:
javahome / lib - as root
appserver / lib - as a child of root
webapp / WEB-INF / lib - as a child of a root child, etc.
Typically, class loaders delegate the loading to their parent class loader (this is called " parent-first "), and if this class loader cannot find the class, then it tries to execute the class loader. For example, if a class deployed as a JAR in webapp / WEB-INF / lib tries to load a class, it first requests a class loader corresponding to loading the appserver / lib class (which, in turn, requests the class loader corresponding to javahome / lib to load class), and if this search failed, then WEB-INF / lib searches for a match to this class.
In a web environment, you may run into problems with this hierarchy. For example, one error / problem that I encountered earlier was that the class in WEB-INF / lib depended on the class deployed to appserver / lib, which in turn depended on the class deployed to WEB-INF / lib. This caused a malfunction because, since class loaders can delegate to the parent class loader, they cannot delegate the tree back. Thus, the WEB-INF / lib class loader would specify the appserver / lib class loader class, the appserver / lib class loader would load this class and try to load the dependent class and fail because it could not find this class in appserver / lib or javahome / Lib.
So, although you cannot deploy your application in a web server or application environment, my explanation too long may be applicable to you if your environment has a hierarchy of loader classes. Does it have? Is JPF a bit of a class loader magic to be able to implement its plugin functions?
matt b Oct 28 '08 at 20:22 2008-10-28 20:22
source share