This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes ClassCastException in EJB client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ClassCastException in EJB client" Watch "ClassCastException in EJB client" New topic

ClassCastException in EJB client

Rahul Dasgupta

Joined: Jun 01, 2002
Posts: 20
My code for an EJB Client throws a ClassCastException. Could you tell me why this is happening and how to avoid it. The EJB(stateless session EJB) has been deployed without any trouble with JNDI name CalculatorJNDI. The EJB class is CalculatorEJB, the home interface is CalculatorHome and the remote interface is Calculator. I am using j2se1.4 and j2ee1.3.1. See the code at, and the exception message at Thanks for any help.
- Rahul
[ March 20, 2003: Message edited by: Rahul Dasgupta ]
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
your links don't work

Asher Tarnopolski
Eduard Manas
Ranch Hand

Joined: May 12, 2002
Posts: 69
That's a nasty one!
I remembered we were having that problem with Websphere some time ago. The reason why you are getting a ClassCastException is because you are trying to cast an Object to the wrong class.
The reason why it was happening to us is because the remote interface had changed, and we were using the old stubs. Re-creating the client stubs was enough to fix the problem.
This may help, but I don't promise you it is the cause of your problem...
Rahul Dasgupta

Joined: Jun 01, 2002
Posts: 20
The links should work now.
- Rahul
It is sorta covered in the JavaRanch Style Guide.
subject: ClassCastException in EJB client
Similar Threads
Question of the day!!
Mock Questions!!
I'd like to add more useful notes @ website
Method Overriding
Exception thrown by servlet