0 Replies Latest reply on Jan 10, 2006 6:41 AM by Thomas Pang

    Jndi/LoginInitialContextFactory initialization problem from

    Thomas Pang Newbie


      We've written a java client to access a permissioned EJB, and therefore we are using the initialcontext factory Jndi/LoginInitialcontextFactory.

      Our client works when we follow the example in links


      that is we have explicitly passed in a properties object to the constructor
      Properties env = new Properties();
      // Try with a login that should succeed
      env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.LoginInitialContextFactory");
      Initialcontext ctx = new InitialContext(env);

      However, when we try to initialize the InitialContext solely via the environment we get a null pointer exception (looking at the line number and the code, it seems the principal is null).

      Hence, the following call doesn't work, assuming no jndi file in classpath, just -D options passed):
      Initialcontext ctx = new InitialContext();

      I'm using the following properties....

      We can get round the problem with the following call, however, it's not ideal:

      InitialContext ctx = new InitialContext(System.getProperties());

      Can anyone think of anything obvious?