users@glassfish.java.net

Re: InitialContext on remote server

From: <glassfish_at_javadesktop.org>
Date: Fri, 05 Dec 2008 10:27:58 PST

I am using Glassfish 9.1_02 (build b04-fcs).

I have created a Stateless EJB (Talker) and a JMS Connection factory (jms/myFactory) on Server2. If I write a standalone java client with the follwoing code:

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.enterprise.naming.SerialInitContextFactory");
env.put("org.omg.CORBA.ORBInitialPort", "3700");
env.put("org.omg.CORBA.ORBInitialHost", "Server2");
env.put("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
env.put("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");

Context ic = new InitialContext(env);

Talker t = (Talker)(ic.lookup("Talker"));
ConnectionFactory connectionFactory = (ConnectionFactory)(ic.lookup("jms/myFactory"));

I get no errors and everything works fine.

If I embed this code is an EJB or Lifecycle Module on Server1 when it is exercised I get the following error:

com.sun.enterprise.connectors.ConnectorRuntimeException: This pool is not bound in JNDI : jms/myFactory
        at com.sun.enterprise.connectors.ConnectorConnectionPoolAdminServiceImpl.obtainManagedConnectionFactory(ConnectorConnectionPoolAdminServiceImpl.java:1091)
        at com.sun.enterprise.connectors.ConnectorRuntime.obtainManagedConnectionFactory(ConnectorRuntime.java:270)
        at com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:113)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at Loader.run(Loader.java:49)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.naming.NameNotFoundException
        at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:268)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:191)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:192)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:192)
        at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
        at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at com.sun.enterprise.connectors.ConnectorConnectionPoolAdminServiceImpl.getConnectorConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:908)
        at com.sun.enterprise.connectors.ConnectorConnectionPoolAdminServiceImpl.obtainManagedConnectionFactory(ConnectorConnectionPoolAdminServiceImpl.java:1027)
        ... 7 more

The EJB lookup succeeds but the JMS Factory lookup fails.
[Message sent by forum member 'janchj' (janchj)]

http://forums.java.net/jive/thread.jspa?messageID=320345