org.omg.CosNaming.NamingContextPackage.NotFound trying to look up an EJB via IIOP in JBoss EAP 7 / 6
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7
- 6
Issue
- Our IIOP client application is getting org.omg.CosNaming.NamingContextPackage.NotFound trying to look up an EJB via IIOP in JBoss EAP 7 / 6 :
javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:63)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:515)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:555)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:532)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at com.fhlbny.customer.client.CpmBackupRunner.main(CpmBackupRunner.java:83)
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:251)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:501)
... 4 more
Resolution
Check the Diagnostics steps below and see How to expose an EJB via IIOP and call it in JBoss EAP 7 / 6
Diagnostic Steps
- Check the server.log and make sure the EJB when deployed shows Remote and Remote Home bindings, search for
JNDI bindings for ... - Check the application's jboss-ejb3.xml to see that IIOP is enabled for the EJB if the
<iiop enable-by-default="true" ...is not set to true - Check the client's lookup to see if it is fully qualified or not, the binding will be fully qualified (the appName/moduleName/EJBName) if the
<iiop ... use-qualified-name="true"/>is set to true, if it is false, then the lookup will just be the EJB's name. - Make sure the server is running one of the full profiles which has the IIOP subsystem enabled
- Check the EJB to ensure it defines the Remote and Remote Home which must extend the objects shown below:
public interface HelloRemote extends javax.ejb.EJBObject {
String hello(String name) throws java.rmi.RemoteException;
}
public interface HelloRemoteHome extends javax.ejb.EJBHome {
public HelloRemote create() throws java.rmi.RemoteException;
}
@javax.ejb.Stateless
@javax.ejb.RemoteHome(HelloRemoteHome.class)
public class HelloSessionBean {
public String hello(String name) {
return "Hello " + name;
}
}
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.