users@glassfish.java.net

ResourceAllocationException using Generic Resource Adapter with GlassFish

From: <glassfish_at_javadesktop.org>
Date: Fri, 22 Jan 2010 09:15:15 PST

I am trying to get JMS to work with our application in a GlassFish V2.x environment. Currently the focus is on the latest version of GlassFish, namely V2.1.1. One of our requirements to keep in mind is that we cannot use Message-Driven Beans.

To test my GlassFish cluster setup I use a simple Servlet that is capable of publishing a message on a topic and receive messages from others. However, initially the subscribing part of the test application seems to have some issues. The code is pretty straight forward. Following is a little snippet dealing with the creation of the publisher and subscriber:

    ...
    initialContext = new InitialContext(environment);
    topicConnectionFactory = (TopicConnectionFactory)initialContext.lookup("ConnectionFactory");
    topic = (Topic)initialContext.lookup("MyTopic");
    topicConnection = topicConnectionFactory.createTopicConnection();
    topicSession = topicConnection.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
    topicPublisher = topicSession.createPublisher(topic);
    topicSubscriber = topicSession.createSubscriber(topic);
    ...

When I deploy this to the cluster I'm running into issues regarding the Client-ID as described in http://bugs.sun.com/view_bug.do?bug_id=6916548

Now I am trying to use the Generic Resource Adapter (https://genericjmsra.dev.java.net/) instead. Following the instructions on http://docs.sun.com/app/docs/doc/820-4335/gbtvg I was able to deploy the genericra.rar to the cluster and to configure it from the looks of it.

When creating a JMS Resources -> Connection Factory, it always creates a Connector Resource and a Connector Connection Pool with the same name as the Connection Factory. The created Connector Connection Pool is automatically configured to use the jmsra as the Resource Adapter.

I created a custom Connector Connection Pool configured to use the genericra.rar and changed the automatically created Connector Resource to point to the new Connector Connection Pool instead of the automatically created one.

Additionally I changed the policy files as mentioned in the online documentation for both the domain1 domain as well as my node agents on each node. (The documentation is not clear what to do in a clustered environment.)

This is all the additional configuration I had to do as far as I understand from the documentation. However, deploying my simple JMS test Servlet to the cluster caused the following exception to occur:

[#|2010-01-21T16:35:46.516-0700|INFO|sun-appserver2.1|com.sun.genericjmsra|_ThreadID=20;_ThreadName=RMI TCP Connection(29)-10.18.40.15;|Error in allocating a connection. Cause: null
javax.resource.spi.ResourceAllocationException: Error in allocating a connection. Cause: null
        at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:353)
        at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:189)
        at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165)
        at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:158)
        at com.sun.genericra.outbound.ConnectionFactory.createConnection(ConnectionFactory.java:75)
        at com.sun.genericra.outbound.ConnectionFactory.createTopicConnection(ConnectionFactory.java:106)
        ... 53 more
Caused by: com.sun.enterprise.resource.PoolingException
        at com.sun.enterprise.resource.AbstractResourcePool.createSingleResource(AbstractResourcePool.java:921)
        at com.sun.enterprise.resource.AbstractResourcePool.createResourceAndAddToPool(AbstractResourcePool.java:1883)
        at com.sun.enterprise.resource.AbstractResourcePool.createResources(AbstractResourcePool.java:979)
        at com.sun.enterprise.resource.AbstractResourcePool.initPool(AbstractResourcePool.java:228)
        at com.sun.enterprise.resource.AbstractResourcePool.internalGetResource(AbstractResourcePool.java:531)
        at com.sun.enterprise.resource.AbstractResourcePool.getResource(AbstractResourcePool.java:458)
        at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:248)
        at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:176)
        at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:337)
        ... 58 more

Just before this exception there's another log entry:

[#|2010-01-21T16:35:46.513-0700|WARNING|sun-appserver2.1|javax.enterprise.resource.resourceadapter|_ThreadID=20;_ThreadName=RMI TCP Connection(29)-10.18.40.15;ConnectorConnectionPool;_RequestID=eda74844-5254-4028-bd83-545ce2776d11;|RAR5117 : Failed to obtain/create connection from connection pool [ ConnectorConnectionPool ]. Reason : null|#]

When looking back into my cluster configuration I discovered that my manually created JMS resource Connection Factory suddenly disappeared!

Any help is appreciated!

Thanks,
Jack...
[Message sent by forum member 'jack_van_ooststroom' (Jack.vanOoststroom_at_ICEsoft.com)]

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