Forum Stats

  • 3,769,840 Users
  • 2,253,027 Discussions
  • 7,875,220 Comments

Discussions

Replacing Base Class Loader

843798
843798 Member Posts: 24,864
edited Jul 31, 2001 6:29PM in Java Runtime Environment (JRE)
Hi All,
I'm using SOAP to transfer Java Objects to my application. Everything works great if the client has access to the class file for the object it receives.
I get a ClassNotFoundException in my deserializer if the class file is not available on the client.
I can solve this problem (I think) if I can replace the base class loader with mine. Does anyone know how this can be done?

Thanks.

Comments

  • 843798
    843798 Member Posts: 24,864
    I don't think there's any way to replace the system classLoader, but I think you can augment it during application initialization with a custom classLoader. See this JavaWorld article.
    http://www.javaworld.com/javaworld/jw-03-2000/jw-03-classload.html
  • 843798
    843798 Member Posts: 24,864
    Thanks for the reply. I think I've got a much better idea of how this stuff works now. I think what I need to do is register my deserializer with SOAP as a class that will really load the deserializer using Class.forName() with my class loader as a parameter. Then when the bootstrap class loader can't find a class, findClass() in my classloader will be called and I can load it from a URL.
    Should work.
    Thanks very much!
This discussion has been closed.