2 Replies Latest reply on Dec 15, 2006 4:46 AM by ma qujun

    Java Client of Embedded EJB3 into Tomcat5.5.20 problem

    ma qujun Newbie

      Is it prossible to use eclipse java class to call embedded EJB3 into Tomcat?

      I knew it's easy for Jboss ejb3 to make it work. But for embedded ejb3 it maybe can not work.
      I try the codes as Jboss EJB3

      final Hashtable<String,String> properties = new Hashtable<String,String>();
      properties.put("java.naming.factory.initial","org.jnp.interfaces.LocalOnlyContextFactory");
      properties.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
      InitialContext ctx = new InitialContext(properties);
      RemoteIntf remote = (RemoteIntf) ctx.lookup(RemoteIntf.class.getName());
      remote.runMethod();
      

      It will throw exception when run on InitialContext ctx = new InitialContext(properties);
      The exception is:
      javax.naming.NamingException: Local server is not initialized
       at org.jnp.interfaces.LocalOnlyContextFactory.getInitialContext(LocalOnlyContextFactory.java:45)
       at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
       at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
       at javax.naming.InitialContext.init(InitialContext.java:223)
       at javax.naming.InitialContext.<init>(InitialContext.java:197)
       at test.Test.main(Test.java:34)
      


      Did the error message means not find service? I think every step I do is correct, but...

      Thanks for any reply