[EMAIL PROTECTED] wrote:
>
> 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???
THe code generated for finder methods have been changed since jonas 2.0
and
I guess this pb (specific to RMI) does not exist anymore.
You can either wait for JOnAS 2.1 (must be released at the beginning of
October)
or take the CVS version of JOnAS and recompile it.
The available cvs tags are :
jonas-2-0
jonas-2-0-1
jonas-2-0-2
jonas-2-0-3
jonas-2-0-4
If you do not supply a tag, you will get the last version (a pre 2.1),
but it may be
not fully tested.
Regards,
Philippe Durieux ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bull - 1 rue de Provence - 38432 Echirolles Cedex France
[EMAIL PROTECTED]
-> Download our EJBServer at http://www.evidian.com/ejb <-
----
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".