Need HELP !! Classloader issue in deserialization

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Need HELP !! Classloader issue in deserialization

dhruv patel
Hi Team,

i am developing one application it uses *"platonos plugin engine".*

design  is like :
server  (intiates plugin engine)
  |----  plugin 1 (dynamically deployed)
  |----  plugin 2*

server accepts plugins, install them and manage their lifecycle.

server maintain registry of services provided by plugins

plugin register their *service classes* to server

Note : service classes loaded by plugin class loader
           server loaded by system default class loader

when any request come to server server identifies proper service class from
registry and call method of plugin

before calling it is doing

this works better for non custom objects. like standard JRE objects (Int,
Long,String etc..)

now my one plugin have one custom object

which is visible in plugin class loader. (present in class path of plugin)

but when it used Java *ObjectInputStream to deserialize* custom object

protected Class<?> resolveClass(ObjectStreamClass desc)
throws IOException, ClassNotFoundException
   return Class.forName(name, false, *latestUserDefinedLoader()*);


latestUserDefinedLoader()  *causes class not found exception.

*latestUserDefinedLoader() return server class loader (IN DEBUG VIEW)*

actually it should use plugin class loader

but this same scenario works properly in Tomact and other webservers with
different classloaders.
i am surprised how to change behaviour of latestUserDefinedLoader()* ??

do i need to change classloader for some security or permission or something
else pls help ???

awaiting for ur reply !!!!

*Dhruv Patel*