BeanShell and class loading

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

BeanShell and class loading

Eugene Krivopaltsev
greetings,

Recently I found a problem with BeanShell and so far I
could not find workaround. I am using proprietary
class loader and works pretty nicely until I read
Interpreter instance from an object stream.

java.lang.ClassNotFoundException:
com.innopath.imdm.iguard.dm.common.DeviceTreeBranch
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
        at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:242)
        at
java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:574)
        at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
        at
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
        at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
        at java.util.Hashtable.readObject(Hashtable.java:848)
        at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:919)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1813)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
        at
java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:468)
        at bsh.Interpreter.readObject(Unknown Source)


The question is how to mandate in the "readObject"
method my class loader. I have no issues with writing
object, bsh classes loaded using my class loader,
however when reading from a stream a system class
loader is used. any suggestions ?

Thanks to all.

--eugene

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users