It looks like you are passing in a class that exists in a war. The classes inside of
a war are special in that they are not visible through the UnifiedClassLoader set
shared by other components. Any classes that are to be used between a war
and other components need to live in the the class loader space above the war.
You need to deploy them with the sar or just a jar referenced by the sar.

The question in this particular example is how is the call from the client to
the services occuring. The RMI layer has to be unmarshalling the Object value
and must obtain the com.newnetco.trivialpursuit.servlets.DaveObject class
to do so. This could be occuring using RMI dynamic class loading, but
I would have to see a complete example to say what is occuring. You could
add:
    System.out.println("Value.class: 
"+value.getClass().getProtectionDomain().getCodeSource());
to the code snippet of setObject to see where the value class is being loaded
from.

If you have a complete example that warrants more investigation attach it to a
bug report at sourceforge:
https://sourceforge.net/tracker/?group_id=22866&atid=376685

xxxxxxxxxxxxxxxxxxxxxxxx
Scott Stark
Chief Technology Officer
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxx

----- Original Message ----- 
From: "David Esposito" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 20, 2002 10:58 AM
Subject: [JBoss-user] RMI vs Local Class Loading


> I don't know if the subject of this message is right ... but i think that's
> the general problem i'm having ... I have an RMI server (MBean) that has a
> method exposed that takes a plain Object. This Object is then serialized out
> to storage so that it can be retrieved later ... The problem I'm having is
> that when I try to deserialize the object, I get a ClassNotFoundException
> ... My suspicion is that the RMI framework is using a different ClassLoader
> than the application code for my RMI server ... Is there anything I can do
> about this? (aside from putting the classes in the classpath on the RMI
> server ahead of time?)
> 
> I'm using JBOSS 3.0.4 on JDK 1.3
> 
> Here's my sample code (i've stripped it down so that the call serializes the
> object into a byte[] array, then tries to deserialize it immeidately ...
> this demonstrate that even within the RMI call itself, i am unable to
> instantiate the object); the "setObject()" method is the exposed RMI method
> ..
> 
> public void setObject(String sessionID, String key, Object value)
> throws Exception{
> 
> java.io.ByteArrayOutputStream bytesOut = new
> java.io.ByteArrayOutputStream();
> java.io.ObjectOutputStream objectOut = new
> java.io.ObjectOutputStream(bytesOut);
> objectOut.writeObject(value);
> objectOut.flush();
> objectOut.close();
> bytesOut.flush();
> bytesOut.close();
> 
> byte[] buf = bytesOut.toByteArray();
> 
> java.io.ByteArrayInputStream bytesIn = new
> java.io.ByteArrayInputStream(buf);
> java.io.ObjectInputStream objIn = new java.io.ObjectInputStream(bytesIn);
> Object obj = objIn.readObject(); //Exception raised here
> objIn.close();
> bytesIn.close();
> 
> }
> 
> 
> The exception is raised on the readObject() call ...
> 
> java.lang.ClassNotFoundException: No ClassLoaders found for:
> com.newnetco.trivialpursuit.servlets.DaveObject
>         at org.jboss.mx.loading.LoadMgr.beginLoadTask(LoadMgr.java:138)
>         at
> org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.java:
> 140)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:195)
>         at
> java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:654)
>         at
> java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:918)
>         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
>         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
>         at
> java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
>         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
>         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
>         at xxxxxx.setObject(SessionManagerImpl.java:270)
> 
> Thanks in advance,
> Dave



-------------------------------------------------------
This SF.NET email is sponsored by:  The Best Geek Holiday Gifts!
Time is running out!  Thinkgeek.com has the coolest gifts for
your favorite geek.   Let your fingers do the typing.   Visit Now.
T H I N K G E E K . C O M        http://www.thinkgeek.com/sf/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to