NullPointerException when trying to use org.wildfly.iiop.openjdk.naming.jndi.CNCtxFactory in standalone java client to connect to JBoss EAP 7 IIOP
Environment
Red Hat JBoss Enterprise Application Platform (EAP) 7
Issue
- Getting NullPointerException in org.wildfly.iiop.openjdk.service.CorbaORBService.getCurrent in JBoss EAP 7 when trying to create IIOP InitialContext using org.wildfly.iiop.openjdk.naming.jndi.CNCtxFactory
[java] java.lang.NullPointerException
[java] at org.wildfly.iiop.openjdk.service.CorbaORBService.getCurrent(CorbaORBService.java:222)
[java] at orgPrinting stacktrace for: null
[java] .wildfly.iiop.openjdk.naming.jndi.CNCtx.initOrbAndRootContext(CNCtx.java:227)
[java] at org.wildfly.iiop.openjdk.naming.jndi.CNCtx.<init>(CNCtx.java:99)
[java] at org.wildfly.iiop.openjdk.naming.jndi.CNCtxFactory.getInitialContext(CNCtxFactory.java:53)
[java] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
[java] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
[java] at javax.naming.InitialContext.init(InitialContext.java:244)
[java] at javax.naming.InitialContext.<init>(InitialContext.java:216)
[java] at com.jboss.examples.ejb3.iiop.client.JDKClient.getIIOPInitialContext(JDKClient.java:211)
Resolution
The Context.INITIAL_CONTEXT_FACTORY should be com.sun.jndi.cosnaming.CNCtxFactory when using a standalone java client trying to invoke EJBs via IIOP on JBoss EAP 7
See How to expose an EJB via IIOP and call it in JBoss EAP 7 / 6 which shows how to invoke IIOP from a standalone java client and from a client running in JBoss EAP
SBR
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.