Hi folks,

following problem occurs when using a finder-method other than the
findByPrimaryKey():

Exception caught: RemoteException occurred in server thread; nested
exception is: 
        java.rmi.RemoteException: Failed to create a new instance of the bean
class Test.TestEJBBean; nested exception is: 
        java.lang.ClassCastException: Test.TestEJBBean
java.rmi.ServerException: RemoteException occurred in server thread;
nested exception is: 
        java.rmi.RemoteException: Failed to create a new instance of the bean
class Test.TestEJBBean; nested exception is: 
        java.lang.ClassCastException: Test.TestEJBBean
java.rmi.RemoteException: Failed to create a new instance of the bean
class Test.TestEJBBean; nested exception is: 
        java.lang.ClassCastException: Test.TestEJBBean
java.lang.ClassCastException: Test.TestEJBBean
        at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
        at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:354)
        at org.objectweb.jonas.rmifilters.RemoteStub.invoke(RemoteStub.java:88)
        at
Test.JOnASTestEJBBeanTestEJBHome_Stub.findByField1(JOnASTestEJBBeanTestEJBHome_Stub.java:74)
        at Test.TestEJBClient.main(TestEJBClient.java:72)


I had a look at the code in the stub and was able to isolate the problem
to one statement that fails. 
It's in the implementation class of the Home-interface
(JOnASTestEJBBeanTestEJBHome).
In the specific finder-method is a call to the inherited method
getAvailable() which returns an instance of the Bean.
The return value is casted to the bean's type and assigned to variable of
the bean's type.
Here's a snippet:

Test.TestEJB eb = null;
try {
        eb = (Test.TestEJB)getAvailable(); //!!!!!!!!!!!
} 
catch (Exception e) 
{
            Trace.errln("Failed to create a new instance of the bean class
Test.TestEJB");
            Trace.errln(e);
            throw new RemoteException("Failed to create a new instance of
the bean class Test.TestEJB", e);
}

I altered the code to so I got the name of the class that is returned so I
stored getAvailable() in an Object variable and did a
object.getClass().getName() which returned me exactly the name "Test.TestEJB" which is 
the
correct type, but nevertheless, a class cast occured.
So I checked the object variable with the instanceof operator and la
voila, this check said it wasn't of the type that it should be casted to.
So I started the VM of the EJBServer with verbose mode and found out that
the class Test.TestEJB was loaded twice?
Why?

Ah, I'm running JOnAS 2.0 on WinNT 4.0 using the normal RMI version. Java
version is JDK1.3 (client + server).

Does anyone has an idea???

BR,
Marc 

-- 
Marc Eilens
mailto: [EMAIL PROTECTED]

Sent through GMX FreeMail - http://www.gmx.net

----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to