users@glassfish.java.net

Retrieving resources from ConnectionFactory results in Connection refused

From: <forums_at_java.net>
Date: Wed, 10 Oct 2012 06:22:18 -0500 (CDT)

I've been working on this for days now, first to get a ConnectionFactory at
all, then to get a Connection-object from it. I am Developing a really simple
standalone JMS client, with just 10 lines of code or so. All it should do is
put a textMessage on a queue somewhere to be determined later. To simulate
this I've set up a vanilla Glassfish container with 1 ConnectionFactory and 1
Queue specified. I left the other settings alone as much as possible. I've
had it all working locally, using the Context.PROVIDER_URL property. But that
didn't work for connecting remotely. Used 2 laptops for that, first at work,
later at home to avoid network-problems. So after alot of searching I found
out I have to set the org.omg.CORBA.ORBInitialHost and
org.omg.CORBA.ORBInitialPort properties. I managed to retrieve a
ConnectionFactory this way, see the code below: Hashtable properties = new
Hashtable(2); properties.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.enterprise.naming.SerialInitContextFactory");
properties.put("org.omg.CORBA.ORBInitialHost", "192.168.1.56");
properties.put("org.omg.CORBA.ORBInitialPort", "3700"); jndiContext = new
InitialContext(properties); connectionFactory = (ConnectionFactory)
jndiContext.lookup("TapServiceConnectionFactory"); // So far so good, now it
fails on creating the connection: connection =
connectionFactory.createConnection(); queue = (Queue)
jndiContext.lookup("TapServiceQueue"); session =
connection.createSession(false, Session.AUTO_ACKNOWLEDGE); When I try to
retrieve the Connection-object from the ConnectionFactory (which also seems
to take forever), it catches a thrown exception, it fails with a "Connection
refused", as seen in this console log: Oct 10, 2012 1:13:51 PM
org.hibernate.validator.util.Version INFO: Hibernate Validator null Oct 10,
2012 1:13:51 PM
org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
INFO: Instantiated an instance of
org.hibernate.validator.engine.resolver.JPATraversableResolver. Oct 10, 2012
1:13:51 PM com.sun.messaging.jms.ra.ResourceAdapter start INFO:
MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version: 4.5.1 (Build 3-b)
Compile: Tue Jun 21 16:31:32 PDT 2011 Oct 10, 2012 1:13:51 PM
com.sun.messaging.jms.ra.ResourceAdapter start INFO: MQJMSRA_RA1101:
GlassFish MQ JMS Resource Adapter starting: broker is REMOTE, connection mode
is TCP Oct 10, 2012 1:13:51 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE
org.omg.CORBA.COMM_FAILURE: FINE: IOP00410001: Connection failure:
socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700 vmcid: OMG minor
code: 1 completed: No at
sun.reflect.GeneratedConstructorAccessor37.newInstance(Unknown Source) at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at
com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
at
com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
at
com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
at
com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
at
com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
at
com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
at $Proxy26.connectFailure(Unknown Source) at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:257)
at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:270)
at
com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:129)
at
com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:223)
at
com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:228)
at
com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:393)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:130) at
org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69) at
com.sun.enterprise.naming.impl.SerialContext$ProviderCacheKey.getNameService(SerialContext.java:1241)
at
com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:411)
at
com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:347)
at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:504)
at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:411) at
com.sun.appserv.connectors.internal.api.ResourceNamingService.lookup(ResourceNamingService.java:223)
at
com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getConnectorConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:871)
at
com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getConnectorConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:854)
at
com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getPoolType(ConnectorConnectionPoolAdminServiceImpl.java:1125)
at
com.sun.enterprise.connectors.ConnectorRuntime.getPoolType(ConnectorRuntime.java:1091)
at
com.sun.enterprise.resource.allocator.AbstractConnectorAllocator.createResourceHandle(AbstractConnectorAllocator.java:209)
at
com.sun.enterprise.resource.allocator.ConnectorAllocator.createResource(ConnectorAllocator.java:163)
at
com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:907)
at
com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1185)
at
com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98)
at
com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:282)
at
com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1501)
at
com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:944)
at
com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:230)
at
com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:511)
at
com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381)
at
com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:242)
at
com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:167)
at
com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:332)
at
com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:301)
at
com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:190)
at
com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165)
at
com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:160)
at
com.sun.messaging.jms.ra.ConnectionFactoryAdapter._allocateConnection(ConnectionFactoryAdapter.java:181)
at
com.sun.messaging.jms.ra.ConnectionFactoryAdapter.createConnection(ConnectionFactoryAdapter.java:168)
at
com.sun.messaging.jms.ra.ConnectionFactoryAdapter.createConnection(ConnectionFactoryAdapter.java:150)
at
nl.tap.service.client.jupiterclientnextgen.SimpleClient.main(SimpleClient.java:74)
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection
refused: connect at
org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:339)
at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:242)
... 40 more Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect0(Native Method) at
sun.nio.ch.Net.connect(Net.java:364) at sun.nio.ch.Net.connect(Net.java:356)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:623) at
com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:110)
at
org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:324)
... 41 more Oct 10, 2012 1:15:39 PM
com.sun.enterprise.resource.allocator.AbstractConnectorAllocator
createResourceHandle WARNING: RAR8067: Unable to determine pool type for pool
[ TapServiceConnectionFactory ], using default pool type Things I've tried: -
Add IP/hostname to hosts-file (Does not seem to matter) - Specify Network
address on orb-listener-1 (Does not seem to matter) - Run glassfish on
windows instead of ubuntu Background info: - Java 7 - JEE6 - Netbeans 7.2 IDE
- Glassfish 3x - Glassfish server running on Ubuntu 11.04 or windows 7 (tried
both, does not matter) - Client running on windows XP or Windows 7 (Tried
both, does not matter) I am really at an end here, there is nothing more I
can think of. If you are able to help me out here, PLEASE do so, I will be
forever in your debt!!

--
[Message sent by forum member 'Gerbenfeenstra2']
View Post: http://forums.java.net/node/891324