NullPointerException in JndiLoginInitialContextFactory.getInitialContext() in JBoss EAP
Issue
- I'm trying to do do a JNDI lookup using the jbossall-client.jar in my client application in JBoss EAP 6. The the configuration is shown below and I'm getting a NullPointerException when trying to setup the initial context, what is causing this?
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
properties.put("jnp.socket.Factory", "org.jnp.interfaces.TimedSocketFactory");
properties.setProperty("java.naming.provider.url", "jnp://remotehost:1099");
MyBean bean = new InitialContext(properties).lookup("example");
The exception I'm getting is:
java.lang.NullPointerException
at org.jboss.security.jndi.JndiLoginInitialContextFactory.getInitialContext(JndiLoginInitialContextFactory.java:95) [jbossall-client.jar:4.3.0.GA_CP09 (build: SVNTag=JBPAPP_4_3_0_GA_CP09 date=201011090309)]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667) [rt.jar:1.6.0_16]
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) [rt.jar:1.6.0_16]
at javax.naming.InitialContext.init(InitialContext.java:223) [rt.jar:1.6.0_16]
...
Environment
- JBoss Enterprise Application Platform (EAP)
- 6.x
- Using JBoss EAP 4.3 jbossall-client.jar library to call EJBs in JBoss EAP 4.3
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.