1 2 Previous Next 15 Replies Latest reply on Jan 28, 2003 10:58 AM by Joyce Stack

    Invoking methods from an EJB on another machien

    Joyce Stack Newbie


      I got a very simple HelloWorld example working on my own machine using JBoss 3.0. The usual first example. I now want to be able to execute a client on my machine that connects to EJBs on a Linux machine that also runs JBoss 3.0.

      I have my two jar files HelloClient.jar with my client classes and interfaces. My HelloJAR.jar with my DD and jboss.xml etc.

      This is my client class with the ip of the linux machine that has my HelloJAR.jar file in the /server/default/deploy directory.

      Hashtable prop = new Hashtable();
      prop.put ("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
      prop.put ("java.naming.provider.url","jnp://");
      prop.put ("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");

      Context ctx = new InitialContext(prop);
      Object obj = ctx.lookup("java:comp/env/ejb/helloworld/HelloWorld");
      HelloWorldHome home = (HelloWorldHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloWorldHome.class);
      HelloWorld helloWorld = home.create();
      String str = helloWorld.sayHelloEJB("JOYCE is COOL");
      catch(Exception e)

      I have placed all jars on the classpath on the linux machine. I have the HelloJAR.jar in the deploy directory on the linxu machine also. When I execute my client on my windows machine I get a NullPointerException on line 25 which is the line
      HelloWorld helloWorld = home.create();

      Can someone put me ont he right track?


        1 2 Previous Next