Community

Stateful EJB 3.0 - ClassCastException

created by Naga Vijayapuram in EJB 3.0 - View the full discussion

Hello,

 

I am trying out a Stateful EJB 3.0 and am getting this when I try to access it from a remote client -

 

$ ./Client.sh
Exception in thread "main" java.lang.ClassCastException: javax.naming.Reference cannot be cast to org.jboss.tutorial.stateful.bean.ShoppingCart
        at org.jboss.tutorial.stateful.client.Client.main(Client.java:21)

 

The same client code works fine from within a jsp page.

 

What could be happenning?  Here's the client code - it fails with above exception during "lookup" from the remote client -

 

InitialContext ctx = new InitialContext();
ShoppingCart cart = (ShoppingCart) ctx.lookup("ShoppingCartBean/remote");

 

NOTE: Reproduced in both JBoss 5.1.0.GA and in JBoss 6 M2.

 

Naga Vijayapuram

Reply to this message by going to Community

Start a new discussion in EJB 3.0 at Community