Skip to main content

Retrieving resources from ConnectionFactory results in Connection refused

1 reply [Last post]
Joined: 2012-10-10

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", "");
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 <clinit>
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(
at java.lang.reflect.Constructor.newInstance(
at $Proxy26.connectFailure(Unknown Source)
at org.omg.CORBA.portable.ObjectImpl._is_a(
at org.omg.CosNaming.NamingContextHelper.narrow(
at com.sun.enterprise.naming.impl.SerialContext$ProviderCacheKey.getNameService(
at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(
at com.sun.enterprise.naming.impl.SerialContext.getProvider(
at com.sun.enterprise.naming.impl.SerialContext.lookup(
at com.sun.enterprise.naming.impl.SerialContext.lookup(
at javax.naming.InitialContext.lookup(
at com.sun.appserv.connectors.internal.api.ResourceNamingService.lookup(
at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getConnectorConnectionPool(
at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getConnectorConnectionPool(
at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getPoolType(
at com.sun.enterprise.connectors.ConnectorRuntime.getPoolType(
at com.sun.enterprise.resource.allocator.AbstractConnectorAllocator.createResourceHandle(
at com.sun.enterprise.resource.allocator.ConnectorAllocator.createResource(
at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(
at com.sun.enterprise.resource.pool.ConnectionPool.createResource(
at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(
at com.sun.enterprise.resource.pool.ConnectionPool.addResource(
at com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(
at com.sun.enterprise.resource.pool.ConnectionPool.createResources(
at com.sun.enterprise.resource.pool.ConnectionPool.initPool(
at com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(
at com.sun.enterprise.resource.pool.ConnectionPool.getResource(
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(
at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(
at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(
at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(
at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(
at com.sun.messaging.jms.ra.ConnectionFactoryAdapter._allocateConnection(
at com.sun.messaging.jms.ra.ConnectionFactoryAdapter.createConnection(
at com.sun.messaging.jms.ra.ConnectionFactoryAdapter.createConnection(
at nl.tap.service.client.jupiterclientnextgen.SimpleClient.main(
Caused by: java.lang.RuntimeException: Connection refused: connect
at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(
... 40 more
Caused by: Connection refused: connect
at Method)
at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(
... 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
- My client is a maven Application, I made a dependency to glassfish-embedded-all-3.1.1.jar. My Glassfish server is v 3.1.2. It does not matter however, I tried to make a non-maven-app, including some necessary jars directly, and it still fails.

Background info:

- Java 7
- JEE6
- Netbeans 7.2 IDE
- Glassfish 3x (3.1.2)
- 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!!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2012-10-10

More then 20 people saw this thread, no response + I've tried everything I could find, and it is starting to look like it cannot be done.... :/

Can anyone suggest an alternative to what I am trying to do? I don't need to use Glassfish necessarilly, any other means to simulate the JMS-queue would suffice, as long as it does not take me too much time and hassle to set up. (Running out of time.) Also another way to code a client would be fine, as long as it is not running in a container.