0 Replies Latest reply on Aug 23, 2005 6:44 AM by Stephan Schwiebert

    getHandle() and EJB 3.0: NullPointerException

    Stephan Schwiebert Newbie

      Hi!

      I would like to combine the fact that you can serialize a Handle to a StatefulSessionBean (to be able to reconnect) with EJB 3.0 annotations. Therefore, I added @Remote and @RemoteHome to my Bean and wrote Interfaces that implement EJBObject and EJBHome so I can access the method getHandle().
      Until here everything works fine - I can do the "classic" lookup, get my Home Interface, can call create() to get the remote interface and can do everything I want to - until I try to use the handle: I get a StatefulHandleImpl, but its jndiname is null, so when I try to call getEJBObject() on it, the code throws a NullPointerException while doing a lookup in Initialcontext. I thought I could solve this problem by setting a jndiname manually via annotation, but when I do so (@RemoteBindings({@RemoteBinding(jndiBinding="...")}) nothing changes, and the annotation seems to be ignored - it is not found during lookup, and in JBoss's jmx-console it is shown under jboss.j2ee, but just as "name=..., service=EJB3", not as jndiName=...
      What am I doing wrong? Am I using the wrong annotation? Or do I have to add some additional jndi.properties? Or am I following a "deprecated way", and with EJB 3.0 I should do different?

      It would be great if someone could give me a hint.

      Thanks,
      Stephan