0 Replies Latest reply on May 6, 2002 3:04 AM by kiuma

    NullPointerException

    kiuma Newbie

      Hi all,
      I have the following code.... and the following problem.


      --------------------------------------------------
      import java.io.IOException;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.rmi.PortableRemoteObject;
      import javax.security.auth.callback.*;
      import javax.security.auth.login.*;
      import org.jboss.test.hello.interfaces.*;

      /** A simple session client that access the two secured EJBs as the user
      passed in on the command line.

      @author Scott_Stark@displayscape.com
      @version $Revision: 1.5 $
      */
      public class MySessionClient
      {
      static java.util.Properties env = new java.util.Properties();

      public static void main(String args[]) throws Exception
      {
      System.out.println(Context.INITIAL_CONTEXT_FACTORY);
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL ,"jnp://localhost:1099");
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      InitialContext ctx = new InitialContext(env);
      System.out.println("context created");
      HelloHome home = (HelloHome)ctx.lookup(HelloHome.JNDI_NAME);
      Hello hello = home.create();
      System.out.println(hello.hello("World"));
      hello.remove();
      }
      }

      --------------------------------------------------
      Jboss 2.2.4 up and running.

      "hello.jar" is the one found here.

      jndiview says:

      +- invokers
      | +- helloworld
      | | +- Hello
      +- jmx



      But I have the following
      error message:

      java.naming.factory.initial
      context created
      Exception in thread "main" java.lang.NullPointerException
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:96)
      at $Proxy0.create(Unknown Source)
      at MySessionClient.main(MySessionClient.java:28)

      What's wrong with my code?

      Thanks in advance,
      /kiuma