I get the same problem with tomcat running in a different VM and with JBoss 2.4.
I can retrieve the object from the ejb but if I cast it, I get a ClassCastException.
Although, the class name of this object returned by my ejb is the right one.
very strange behaviour.
Please, if you have informations on this...
I don't get this problem if I run JBoss 3 beta, and Tomcat on different VMs
I'm not sure what you mean
In normal cases, you don't need to cast the class that is returned by the EJB, since you specified the return type in your EJB method's signature. It's reasonable to get ClassCastException if your returned class that isn't a sub/super-class of your return type. For my case, I don't do any casting in my code, but I still get such exception (it may be the stub)!!!
But if you return the type java.lang.Object, and cast that in your code, and get such exception, then we are getting the same problem :(
look at: http://sourceforge.net/tracker/index.php?func=detail&aid=523909&group_id=22866&atid=376685
I said I tried to cast, but ,no, actually, I do not have any cast. What I do, I retrieve a Vector of 'my_object' and I copy it into an array of type my_object.
This is where the class cast exception is thrown.
I still have the same problem. But I managed to have it running by playing with the classpaths.
If you jave tomcat+jboss on the same machine, add your deployed jar in the classpath. It works.
But that's not what I want.
I want Tomcat on another machine and I want to distribute a client.jar on this machine.
I keep investigating.
If anyone found a smart workaround, please help.
To me, this isn't a bug, try:
String a = (String) v.toArray(new String[v.size()]);
where a is the array, and v is the vector, and the String class is used here for an example
I have the same problem in same configuration (jboss-3.0.0beta_tomcat-4.0.2.tgz) and I have following things to add:
1. Class casting fails not only for EJB method's result, but for other classes returned from EJB. For example, if an EJB throws java.rmi.RemoteException(String message, Throwable detail), the detail.getClass().getName() returns the same name as local detail class implementation, but casting, instanceof and .equals() failed.
2. It seems it is a bug in EmbeddedCatalinaServiceSX implementation, because
it works fine for standalone Catalina.