HornetQ as Resource Adapter - JNDI Lookup
germ Aug 28, 2011 5:18 AMPerhaps someone can tell me what's wrong here. It might be something obvious, but I'm starting to suspect not. I'm trying to deploy HornetQ (2.2.5 Final) as a resource adapter to connect to an external HornetQ instance in JBoss AS (7.0.1).
I extract hornetq-ra.rar and modify ra.xml to configure a few things, as this seems to be required by this bug:
https://issues.jboss.org/browse/AS7-1452
I then edit my standalone.xml file, and modify the resource adapters subsection, like so:
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"> <resource-adapters> <resource-adapter> <archive>hornetq-ra.rar</archive> <transaction-support>XATransaction</transaction-support> <config-property name="UserName">myusername</config-property> <config-property name="Password">mypassword</config-property> <connection-definitions> <connection-definition class-name="org.hornetq.ra.HornetQRAConnectionFactory" jndi-name="java:/jms/RemoteConnectionFactory" enabled="true" use-java-context="true" pool-name="JmsRemoteConnectionFactory" use-ccm="true"> <config-property name="UserName">myusername</config-property> <config-property name="ConnectionParameters">host=localhost;port=5445</config-property> <config-property name="ConnectorClassName">org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</config-property> <config-property name="SessionDefaultType">javax.jms.Queue</config-property> <config-property name="Password">mypassword</config-property> <pool> <min-pool-size>10</min-pool-size> <max-pool-size>100</max-pool-size> </pool> <security> <application>true</application> </security> </connection-definition> </connection-definitions> </resource-adapter> </resource-adapters> </subsystem>
The HornetQ resource adapter does seem to deploy successfully, so I don't think my problem is there. However, when I attempt to make use of this connection factory in a test EJB:
@Startup @Singleton @TransactionAttribute(TransactionAttributeType.REQUIRED) public class Sender { @Resource(lookup="java:/jms/RemoteConnectionFactory") private QueueConnectionFactory connectionFactory;
... I have much less success, resulting in my test project not deploying with the following error:
INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 1) Deployment of "test.jar" was rolled back with failure message {"Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.test.test.Sender.\"env/test.Sender/connectionFactory\" missing [ jboss.naming.context.java.jms/RemoteConnectionFactory ]"]}
Can anyone see anything wrong with my sample here, or is there something I don't understand about JNDI lookup and EJB3.1?