-
1. Re: A BUG about ClassCastException in jboss-3.0.0beta_tomcat
oli306 Mar 6, 2002 9:22 AM (in response to twhphan)Hi,
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...
thanks. -
2. Re: A BUG about ClassCastException in jboss-3.0.0beta_tomcat
twhphan Mar 6, 2002 11:12 AM (in response to twhphan)Hi,
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 -
3. Re: A BUG about ClassCastException in jboss-3.0.0beta_tomcat
oli306 Mar 12, 2002 10:02 AM (in response to twhphan)yes,
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.
thanks. -
4. Re: A BUG about ClassCastException in jboss-3.0.0beta_tomcat
twhphan Mar 14, 2002 3:56 AM (in response to twhphan)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 -
5. Re: A BUG about ClassCastException in jboss-3.0.0beta_tomcat
mtup Mar 19, 2002 2:53 AM (in response to twhphan)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. -
6. Re: A BUG about ClassCastException in jboss-3.0.0beta_tomcat
adrian.brock Mar 19, 2002 5:47 AM (in response to twhphan)You probably want to read this.
http://main.jboss.org/thread.jsp?forum=47&thread=10977
Regards,
Adrian