-
1. Re: ClassCastExeception on EntityBean returned from Stateles
djl1 Nov 23, 2005 12:43 PM (in response to kcturner)If its any consolation, I am having a similar problem (but I think I incorrectly posted it on Javassist forum):
Seemingly after I pass a Vector, ArrayList or some other concrete collection from a stateless session bean to a client (in a servlet), when I come to do the iteration and thereby casting of the objects, it throws a ClassCastException in the iter.next() statement. Is there something I am doing wrong, as this seems to me to be elementary capability?
I am running JBoss 4.0.3SP1 on Win 2k (SP4) with Java SDK 1.4.2_04 and Hibernate 3.1RC2 (same as that which comes with JBoss).
Note that the collection iterates fine at the Session Bean end, so its not Hibernate related. -
2. Re: ClassCastExeception on EntityBean returned from Stateles
bogsolomon Nov 23, 2005 12:51 PM (in response to kcturner)Try adding a System.out(whateveryouarereturning) or log.debug(whateveryouarereturning) so that you can see the class type of what it is returning. I remember I had the same problem and that helped me. If I remember right I was expecting a Set but it was returning a List.
In your case if you do a .find that would not be the case but knowing what you get back and what you expect should help. -
3. Re: ClassCastExeception on EntityBean returned from Stateles
djl1 Nov 23, 2005 1:20 PM (in response to kcturner)Thanks, but I think I've sussed it. Fixed it by setting attribute CallByValue in deploy/ear-deployer.xml to true. Not obvious to us newbies, mind.
Came up in a previous post on Jun 7 (search for ClassCastException). -
4. Re: ClassCastExeception on EntityBean returned from Stateles
djl1 Nov 23, 2005 1:30 PM (in response to kcturner)Incidentally, I did try your suggestion "Bog", and it returned the correct class name that I was expecting; just when it came to casting, it threw a CCE wobbly.
Another thing I tried was to rearrange the war file to remove any duplicate pojo jar files (from another posted solution to a CCE problem), but that made no difference. However, now I understand a bit more about the class loader, so I can slim my war files down!