If I try to access a remote EJB using injection in the client side (an enterprise client application running on another Glassfish server) like this
@EJB(mappedName = "corbaname:iiop:10.129.130.122:34481#com.sun.tutorial.javaee.ejb.timersession.TimerSession")
private static TimerSession timer;
I get the remote reference loaded.
If I try to do the same commenting out the @EJB annotation and using this:
//1st way
Properties props1 = new Properties();
props1.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props1.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
props1.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props1.setProperty("org.omg.CORBA.ORBInitialHost", "10.129.130.122");
props1.setProperty("org.omg.CORBA.ORBInitialPort", "34481");
InitialContext ic1 = new InitialContext(props1);
timer = (TimerSession) ic1.lookup("corbaname:iiop:10.129.130.122:34481#com.sun.tutorial.javaee.ejb.timersession.TimerSession");
//2nd way
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
props.setProperty(Context.PROVIDER_URL, "iiop://10.129.130.122:34481");
timer = (TimerSession) ic1.lookup("corbaname:iiop:10.129.130.122:34481#com.sun.tutorial.javaee.ejb.timersession.TimerSession");
it doesnt work. Always the same error:
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:44)
If I do the lookup only on the last part of the name("com.sun.tutorial.javaee.ejb.timersession.TimerSession") the error is
javax.naming.NameNotFoundException: com.sun.tutorial.javaee.ejb.timersession.TimerSession#com.sun.tutorial.javaee.ejb.timersession.TimerSession not found
But if I browse JNDI in the target server, the name [b]com.sun.tutorial.javaee.ejb.timersession.TimerSession#com.sun.tutorial.javaee.ejb.timersession.TimerSession[/b] appears in the listing. In fact the injection version works.
Any ideas?
Thanks
[Message sent by forum member 'aperezymadrid' (aperezymadrid)]
http://forums.java.net/jive/thread.jspa?messageID=254811