Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

Classloader isolation and Manifest Class-Path headers

Thread view: 
ljnelson@gmail.com - 31 Mar 2006 20:23 GMT
I have hit a brick wall here.

I have a system that loads modules.  Each module is represented by a
jar file.  Each jar file is loaded by its own URLClassLoader whose
classpath is simply that jar file and nothing else.

Now, each jar file may "widen" its own classpath by specifying things
in its Class-path header in its manifest, in accordance with the jar
specification.

What I'm finding is that classes that are loaded by way of this
extension mechanism--and, although I haven't tested it, I suspect all
classes, actually--"leak" over to another module's loader, rather than
being loaded by *that* module's loader.  An example should help.

Consider three jars, A, B and C.  A is loaded by loaderA, B is loaded
by loaderB, and C appears in the Class-path header of A and B.  C, in
turn, contains Foo.class, which is needed by A and B.

If A is loaded first, then Foo.class is loaded by loaderA, and when B
goes to look at it, it sees that Foo's classloader is loaderA instead
of loaderB.  I don't want this; I want two potentially separate
instances of Foo loaded.

How can I accomplish this?  Must I override the findLoadedClass()
method in URLClassLoader to keep track of the classes I've actually
loaded (instead of dropping down to the private native
findLoadedClass0() method in java.lang.Classloader)?

Thanks,
Laird
ljnelson@gmail.com - 31 Mar 2006 23:26 GMT
The issue turned out to be much more esoteric than this would lead you
to believe.  I have a writeup available at
http://jroller.com/page/ljn?entry=bsfmanager_hijinks for those who are
interested.

Thanks,
Laird


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.