I have a CMP Entity bean that extends a value object class (I'll call this
class MyValueObject.class). MyValueObject.class has a dependent object
(MyDependentObject.class) which is defined / mapped in my ejb-jar.xml using
the <dependent/> and <ejb-relation/> tag sets. This ejb has a getData or
getValueObject method that returns a MyValueObject.class and the contained
MyDependentObject.class. Both the value object and the dependent objects are
serializable.

Now I have an ormi client that looks up the bean and invokes one of the
bean's finder methods. What I get back is an exception that looks similar to
the following:

java.rmi.UnmarshalException: Error deserializing return-value:
MyDependentObject_Dependent1; 
java.lang.ClassNotFoundException: MyDependentObject_Dependent1 
        
at.com.evermind.server.rmi.RMIClassLoader.findClass(RMIClassLoader.java:71)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:195)
        at
com.evermind.server.rmi.RMIInputStream.resolveClass(RMIInputStream.java:133)
        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.inputClassFields(ObjectInputStream.java:2262)
        at
java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:519)
        at
java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1411)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
        at
com.evermind.server.rmi.RMIInputStream.readType(RMIInputStream.java:118)
        at
com.evermind.server.rmi.RMIConnection.handleMethodInvocationResponse(RMIConn
ection.java:1423)
        at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:471)
        at java.lang.Thread.run(Thread.java:484)

Now I know what the problem is. Orion / CMP extends my
MyValueObjectEntityBean.class and any dependent objects such as
MyDependentObject. And I understand why Orion must do this for CMP
management. The finder is returning my ValueObject, but it's returning the
dependent object as the dependent object class that Orion built - which is
obviously not in the class path of my client - which expects
MyDepentObject.class and not Orion's MyDependentObject_Dependent1.class. It
doesn't make much sense for me to include this class with the client as the
number at the end of the class changes each time I re-deploy my bean or app.

With this in mind, I guess I could do something ugly like a copy constructor
/ cast on all returned finder matches on the server side - which I really
don't want to do. I could also switch to BMP, which I would probably do as a
last resort. I've also tried tweaking some of the settings in my
config/rmi.xml file and saw no change in the above stack trace.

Has anyone found another workaround that would allow me to keep CMP here?

Thanks.... 

Reply via email to