users@glassfish.java.net

JNDI lookup from outside glassfish

From: Tim Dudgeon <tdudgeon_at_informaticsmatters.com>
Date: Tue, 26 May 2009 20:27:34 +0100

I'm having difficulty creating a JNDI context for a standalone
application (running outside glassfish).
Getting the context is fine within glassfish.

For what I understand the jndi.properties for an InitialContext running
on localhost is already defined inside the appserv-rt.jar, so all
that should be necessary is to have this on the classpath (along with
other necessary jars) and then all that is needed is:
InitialContext jndi = new InitialContext();

But when I try I get the following exception.
(This is with glassfish 2.1 running inside Netbeans, and client app
running inside netbeans. OS is Linux. Java is 1.6).

26-May-2009 19:19:17
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType:
IIOP_CLEAR_TEXT; hostname: localhost; port: 3700"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
        at
com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
        at
com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
        at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
        at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
        at
com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
        at
com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
        at
com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
        at
com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
        at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
        at
org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
        at
com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:134)
        at
com.sun.enterprise.naming.SerialContext.getCachedProvider(SerialContext.java:259)
        at
com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:204)
        at
com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:159)
        at
com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:409)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at jmsclient.Main.<init>(Main.java:59)
        at jmsclient.Main.main(Main.java:38)
Caused by: java.lang.RuntimeException: java.net.ConnectException:
Connection refused
        at
com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
        at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
        ... 15 more
Caused by: java.net.ConnectException: Connection refused
        at sun.nio.ch.Net.connect(Native Method)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
        at
com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
        at
com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
        ... 16 more


What am I missing?

Thanks
Tim