Our Craft

Making it better

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

Posted by danielmeyer on July 8, 2008

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 jndi.properties 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…

About these ads

4 Responses to “Trying out XA, part 5: a resource adapter rabbit trail”

  1. J said

    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
    javax.jms.ConnectionFactory

  2. danielmeyer said

    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.

  3. danielmeyer said

    I think JarSearch is going to be a help to us for issues like this going forward…

  4. J said

    Thanks for the pointer to JarSearch. It looks quite useful.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.