I tried the following and everything is working fine.
When creating an InitialContext like:
Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory"); props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost"); props.setProperty("org.omg.CORBA.ORBInitialPort", "3700"); InitialContext ctx = new InitialContext(props);
And later
myBeanService = (MyBeanService) ctx.lookup("java:global/AppName/MyBeanService");
This exception shows, but if I just call like this:
myBeanService = (MyBeanService) new InitialContext().lookup("java:global/AppName/MyBeanService");
No problems. The problem is the JNDI properties.
source share