1 Reply Latest reply on May 23, 2008 8:15 PM by 666705

    How do I resolve a NullPointerException in call to InitialContext?

    666705
      I am trying to test an EJB3.0 bean in WLS 10.0 using a Client App. I use the following code to try to get the Initial Context:

      public static Context getInitialContext() throws javax.naming.NamingException
      {
      Context newContext = null;
      try
      {
      Properties p = new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
      p.put(Context.PROVIDER_URL, "t3://localhost:7101");
      p.put(Context.SECURITY_PRINCIPAL,"weblogic");
      p.put(Context.SECURITY_CREDENTIALS,"weblogic");
      newContext = new javax.naming.InitialContext(p);
      }
      catch (Exception e)
      {
      e.printStackTrace();
      }
      return newContext;
      }

      I keep getting a NullPointerException in a call to java.lang.Class$MethodArray.addAll from the InitialContext(p) call.

      Can anyone point me in the right direction to get this resolved?

      Thanks