Trying out XA, part 5: a resource adapter rabbit trail

In Part 4, we ended up stuck and wanting to post a question somewhere.  As often happens, as part of pulling together data to ask a question, I do more research…

Part of a thread from the ActiveMQ Users list says:

> Are the connection factories/queues/topics just exposed by the RAR for use
> within the J2EE server only.

Yes – as they are not using the regular JMS client API – they are
using J2EE RA stuff

You’ll need to setup a regular JMS connection and any destination
objects you want in JNDI somewhere. Using JBoss’s JNDI provider could
well work fine though – just make sure its actually normal JMS client
objects (ConnectionFactory & destinations) – and not RA stuff.  Also
make sure the J2EE server and your stand alone client are using the
exact same ActiveMQ jars since its gonna be using Java serialization
to transmit the Java objects in JNDI

(Emphasis mine.)  Ok, so looks like the classes I’m JNDI-lookuping aren’t intended for outside-the-app-server use.  But there is a way… the rest of the thread discusses an alternative, but I’m not sure that it would work with XA transactions.

But……… ActiveMQ’s JNDI Support page shows how to use a file to specify, among other things, a connection factory.  Let’s try that tomorrow!

Update 7/23/2008: See the Something works! post for what was actually the cause of the ClassCastExceptions…

4 thoughts on “Trying out XA, part 5: a resource adapter rabbit trail

  1. Do you have any activemq or jms related jar files in you war/ear if so remove them from the war/ear. These can conflict with the activemq ra and cause class cast exceptions.

    You should then be able to look up the connection factory as

  2. J,
    Yes, that was it! We tracked down the duplicate jar files and tweaked the Maven pom file to leave them out, and then the connection factory could be cast to a javax.jms.ConnectionFactory.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.