2 Replies Latest reply on Oct 21, 2004 11:28 AM by tmike

    NullPointerException: at org.jboss.ejb.plugins.local.LocalHo

    tmike Newbie

      Hi guys, I have a few questions about how to look up local ejb

      this is just part of my client code, which will be run as another java app.

      ctx = new InitialContext(props);
      System.out.println(MikeLocalHome.COMP_NAME);

      MikeLocalHome home = (MikeLocalHome) ctx.lookup("MikeLocal");

      a = home.create();

      this is the exception I got when I try to do a create()
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)

      I've search various post on this topic from the forum. It says I can't reference a local EJB on the other JVM. What does other JVM means, if i start up JBoss app. server..it runs on its own JVM?...so, if I start up my client app, it's on another JVM?..even though it's the same computer

      also, if I can't run local ejb on my client code, how would I test it?..I've seen post saying use remote interfaces, and JBoss will optimize the performance?..is that true?...does that mean I can let my servlet access ejb remotely(use remote interface), but JBoss will treat them as local ejb?...

      btw, if I deploy my local ejb in a servelt and access, it works fine...

      sorry for the long post...tks a lot!!

        • 1. Re: NullPointerException: at org.jboss.ejb.plugins.local.Loc
          Darran Lofthouse Master

          When a java programme is executed by using the command 'java classname' a process called the JVM or Java Virtual Machine is started to execute the bytecode in the specified class.

          By starting JBoss and your application separately they are both running in their own JVMs and will both have their own java process running.

          Local insterfaces can only be used by components running within the JBoss JVM, this is why your servlet is able to access them.

          Generally access to entity beans should be wrapped by session beans and your remote application can then call the remote interface of the session bean that will then use the local interface of the entity beans. Switching to using remote interfaces for your entity beans will stop you from making use of CMR if you require it later.

          • 2. Re: NullPointerException: at org.jboss.ejb.plugins.local.Loc
            tmike Newbie

            tks for the quick reply...

            I am guessing if i use local interface, I can't test it by writing a simple client code(since it'll be run on its own vm)....but I'll able to test it through a servlet connection or something.....

            if I let my servlet use remote ejb interfaces to access ejb beans, would it be optimized by jboss?...for ex. jboss will notice that servlet and beans exist in same vm, and do something about it(make it reference locally or something?)..

            tks!!