2 Replies Latest reply on Apr 30, 2010 8:19 AM by nvwm

    Stateful EJB 3.0 - ClassCastException

      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