0 Replies Latest reply on Mar 19, 2008 1:14 PM by Bruno Marchesson

    NullPointerException when calling @Remote EJB

    Bruno Marchesson Newbie

      Hi,

      I am trying to implement unit test for my EJB3 application, but I am facing some issues.
      I am using the beta3 and followed the instructions from the Wiki (Bootstrap.getInstance().bootstrap() and Bootstrap.getInstance().deploy(jar)...)

      I have a remote Inteface :
      @Remote
      public interface IConfigurationDAO { ... }

      implemented by :
      @Stateless
      public class ConfigurationDAO implements IConfigurationDAO { ... }

      When executing the following code :
      Context context = new InitialContext();
      IConfigurationDAO dao = (IConfigurationDAO) context.lookup("ConfigurationDAO/remote");
      assertNotNull(dao);
      dao.save(...); <-- The NullPointerException comes here !

      I got the stack trace :
      java.lang.NullPointerException
      at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:280)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:81)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:108)
      at $Proxy55.create(Unknown Source)
      at com.cegelec.evolynx.server.dao.ConfigurationDAOTest.testLoadCompleteConfigurationByRole(ConfigurationDAOTest.java:99)
      ...

      The strange thing is that if I change the interface annotation to @Local (and change the context lookup to the appropriate name), the test works fine :-/

      Can anyone help me on that ?