geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fredrik Jonson <fred...@myrealbox.com>
Subject How do I declare and inject a jms resource in a connector component?
Date Wed, 21 Jan 2009 15:44:54 GMT
Hi, 

I have a ear that contains a rar with a ResourceAdapter. In my
resource adapter I need to use the jms resources that I've declared
in geronimo-application.xml - a activemq connection factory and
a queue. 

I've tried to inject with annotations:

 public class FooAdapter implements ResourceAdapter
 {
    @Resource(name = "ConnectionFactory")
    private javax.jms.ConnectionFactory connectionFactory;
    @Resource(name = "foo.gateway")
    private Queue gatewayQueue;

    ...

But when I do that my adapter just hangs on the call to:

    Connection c = connectionFactory.createConnection();

I also tried jndi lookup, and it fails too, so I suspect that I need
to declare that the rar component has a dependency on the jms-resources
that I have declared in geronimo-application.xml?

The thing is, I do not see any exceptions when I deploy the jca component,
and geronimo seems to inject something. Otherwise I'd expect a nullpointer
exception on deployment.

Anyway, I'd be greatful for any help here.

Below is my geronimo-ra.xml (the ra.xml is as minimal):

<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
  <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
    <dep:moduleId>
      <dep:groupId>foo</dep:groupId>
      <dep:artifactId>foo-connector</dep:artifactId>
      <dep:version>1.0.0</dep:version>
      <dep:type>rar</dep:type>
    </dep:moduleId>
  </dep:environment>
  <resourceadapter>
    <resourceadapter-instance>
      <resourceadapter-name>foo.FooAdapter</resourceadapter-name>
      <workmanager>
        <gbean-link>DefaultWorkManager</gbean-link>
      </workmanager>
    </resourceadapter-instance>
  </resourceadapter>
</connector>

-- 
Fredrik Jonson


Mime
View raw message