users@glassfish.java.net

InitialContext properties - connect server on different port

From: <glassfish_at_javadesktop.org>
Date: Fri, 15 Jan 2010 05:54:38 PST

I'm trying to connect a stand-alone client to a glassfish running on non-standard ports (i.e. the ORB port is not 3700 but 8037). Which properties have to be supplied when creating InitialContext?

I've tried the following:

    Properties prop = new Properties();
    prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                              "com.sun.enterprise.naming.SerialInitContextFactory");
    prop.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
    prop.setProperty("org.omg.CORBA.ORBInitialPort", "8037");
    Context ctx = new InitialContext(prop);

That works for simple JNDI entries, e.g. EJB remote objects.

But when I try to lookup a jms resource like "jms/ConnectionFactory" (the JNDI name of a JMS connection factory configured with asadmin), the server seems to follow a naming reference using the standard port 3700 again - see exception below.

Thanks for your help!

Regards
Dirk


15.01.2010 14:49:30 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
15.01.2010 14:49:32 com.sun.enterprise.connectors.jms.util.JmsRaUtil getInstalledMqVersion
WARNUNG: jmsra.upgrade_check_failed
15.01.2010 14:49:32 org.hibernate.validator.util.Version <clinit>
INFO: Hibernate Validator bean-validator-3.0-JBoss-4.0.2
15.01.2010 14:49:33 org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
15.01.2010 14:49:33 com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMS Resource Adapter starting: REMOTE
15.01.2010 14:49:33 com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMSRA Started:REMOTE
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3431)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3452)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:256)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:269)
        at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:125)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:188)
        at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:186)
        at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:352)
        at org.omg.CORBA.portable.ObjectImpl._is_a(Unknown Source)
        at org.omg.CosNaming.NamingContextHelper.narrow(Unknown Source)
        at com.sun.enterprise.naming.impl.SerialContext.narrowProvider(SerialContext.java:355)
        at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:327)
        at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:271)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getConnectorConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:804)
        at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.obtainManagedConnectionFactory(ConnectorConnectionPoolAdminServiceImpl.java:932)
        at com.sun.enterprise.connectors.ConnectorRuntime.obtainManagedConnectionFactory(ConnectorRuntime.java:375)
        at com.sun.enterprise.resource.naming.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:124)
        at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
        at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:472)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:437)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at de.gedoplan.seminar.jms.demo.DemoProducer.main(DemoProducer.java:25)
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect
        at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:239)
        ... 21 more
Caused by: java.net.ConnectException: Connection refused: connect
        at sun.nio.ch.Net.connect(Native Method)
        at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
        at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:106)
        at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:325)
        ... 22 more
15.01.2010 14:50:53 com.sun.enterprise.naming.impl.SerialContext lookup
SCHWERWIEGEND: enterprise_naming.serialctx_communication_exception
15.01.2010 14:50:53 com.sun.enterprise.naming.impl.SerialContext lookup
SCHWERWIEGEND:
java.lang.RuntimeException: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: This pool is not bound in JNDI : jms/ConnectionFactory
        at com.sun.enterprise.resource.naming.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:159)
        at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
        at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:472)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:437)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at de.gedoplan.seminar.jms.demo.DemoProducer.main(DemoProducer.java:25)
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: This pool is not bound in JNDI : jms/ConnectionFactory
        at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.obtainManagedConnectionFactory(ConnectorConnectionPoolAdminServiceImpl.java:1017)
        at com.sun.enterprise.connectors.ConnectorRuntime.obtainManagedConnectionFactory(ConnectorRuntime.java:375)
        at com.sun.enterprise.resource.naming.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:124)
        ... 5 more
Caused by: javax.naming.NamingException: Lookup failed for '__SYSTEM/pools/jms/ConnectionFactory' in SerialContext ,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext ,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]]
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getConnectorConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:804)
        at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.obtainManagedConnectionFactory(ConnectorConnectionPoolAdminServiceImpl.java:932)
        ... 7 more
Caused by: javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext ,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]
        at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:276)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
        ... 10 more
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3431)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3452)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:256)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:269)
        at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:125)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:188)
        at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:186)
        at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:352)
        at org.omg.CORBA.portable.ObjectImpl._is_a(Unknown Source)
        at org.omg.CosNaming.NamingContextHelper.narrow(Unknown Source)
        at com.sun.enterprise.naming.impl.SerialContext.narrowProvider(SerialContext.java:355)
        at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:327)
        at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:271)
        ... 11 more
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect
        at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:239)
        ... 21 more
Caused by: java.net.ConnectException: Connection refused: connect
        at sun.nio.ch.Net.connect(Native Method)
        at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
        at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:106)
        at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:325)
        ... 22 more
Exception in thread "main" javax.naming.CommunicationException: Communication exception for SerialContext targetHost=localhost,targetPort=8037,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is java.lang.RuntimeException: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: This pool is not bound in JNDI : jms/ConnectionFactory]
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:461)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at de.gedoplan.seminar.jms.demo.DemoProducer.main(DemoProducer.java:25)
Caused by: java.lang.RuntimeException: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: This pool is not bound in JNDI : jms/ConnectionFactory
        at com.sun.enterprise.resource.naming.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:159)
        at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
        at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:472)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:437)
        ... 2 more
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: This pool is not bound in JNDI : jms/ConnectionFactory
        at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.obtainManagedConnectionFactory(ConnectorConnectionPoolAdminServiceImpl.java:1017)
        at com.sun.enterprise.connectors.ConnectorRuntime.obtainManagedConnectionFactory(ConnectorRuntime.java:375)
        at com.sun.enterprise.resource.naming.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:124)
        ... 5 more
Caused by: javax.naming.NamingException: Lookup failed for '__SYSTEM/pools/jms/ConnectionFactory' in SerialContext ,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext ,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]]
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getConnectorConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:804)
        at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.obtainManagedConnectionFactory(ConnectorConnectionPoolAdminServiceImpl.java:932)
        ... 7 more
Caused by: javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext ,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]
        at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:276)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
        ... 10 more
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3431)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3452)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:256)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:269)
        at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:125)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:188)
        at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:186)
        at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:352)
        at org.omg.CORBA.portable.ObjectImpl._is_a(Unknown Source)
        at org.omg.CosNaming.NamingContextHelper.narrow(Unknown Source)
        at com.sun.enterprise.naming.impl.SerialContext.narrowProvider(SerialContext.java:355)
        at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:327)
        at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:271)
        ... 11 more
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect
        at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:239)
        ... 21 more
Caused by: java.net.ConnectException: Connection refused: connect
        at sun.nio.ch.Net.connect(Native Method)
        at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
        at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:106)
        at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:325)
        ... 22 more
[Message sent by forum member 'dweil' (dirk.weil_at_web.de)]

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