ClassCastException on EJB Client


EJB programming & troubleshooting: ClassCastException on EJB Client

  1. ClassCastException on EJB Client (1 messages)

    Hi all, I've been reading the Mastering EJBs 3.0 book lately and I'm coding along. In the 3rd chapter there's the example of a stateless session bean with a hello world Method. I've managed to deploy this to JBoss easily. But my problem lies with the client. When I try to get the remote object like this: Hello hello = (Hello)ctx.lookup("HelloBean"); I get a class cast exception like this: Exception in thread "main" java.lang.ClassCastException: org.jnp.interfaces.NamingContext cannot be cast to gr.dvm.Hello at gr.dvm.HelloClient.main( I've declared my bean @Remote. What else do I need to do?
  2. Re: ClassCastException on EJB Client[ Go to top ]

    Use PortableRemoteObject.narrow(hello,Hello.class);