9 Replies Latest reply on Sep 3, 2009 8:55 AM by jaikiran pai

    class java.lang.ClassCastException in EJB3.0 lookup

    Harish Newbie

      Hi All,

      I'm trying to invoke a sample HelloBean EJB 3.0 in JBOSS 4.2.2. But getting following error
      -------------------ERROR -----------------
      11:20:53,187 WARN [RequestProcessor] Unhandled Exception thrown: class java.lang.ClassCastException
      11:20:53,187 ERROR [[action]] Servlet.service() for servlet action threw exception
      java.lang.ClassCastException: $Proxy63 cannot be cast to examples.session.stateless.Hello
      ------------------------------------------
      EJB jar file deployment was successful.

      Trying to lookup in my servlet as shown below, which throws above stated error

      Hello hello = (Hello) ctx.lookup("HelloBean/remote");

      However, on calling
      System.out.println("--->"+ctx.lookup("HelloEJB/remote"));
      outputs
      --->jboss.j2ee:jar=firstEJB3.jar,name=HelloEJB,service=EJB3

      It is unable to cast it to the Remote interface.

      Can anyone help me?.

      Thanks in advance