Porting WLS8.1 to JBoss5 - JNDI lookup for XA factory return
lwalter Apr 27, 2009 10:11 PMG'day,
This is probably a newbie question, but I couldn't find the answer in a few days of Googling. I'm trying to port a JMS-using app from Weblogic 8.1 to JBoss 5.0.
I've configured a transactional JMS factory like this in jms-ds.xml:
<tx-connection-factory> <jndi-name>applications/ig/jms/INVOICE_GENERATOR_CF</jndi-name> <use-java-context>false</use-java-context> <xa-transaction/> <rar-name>jms-ra.rar</rar-name> ..etc..
This is then set up in connection-factories.xml:
<mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory" name="jboss.messaging.connectionfactory:service=ConnectionFactory" xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml"> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends> <depends>jboss.messaging:service=PostOffice</depends> <attribute name="JNDIBindings"> <bindings> <binding>/ConnectionFactory</binding> <binding>/XAConnectionFactory</binding> <binding>java:/ConnectionFactory</binding> <binding>java:/XAConnectionFactory</binding> <binding>applications/ig/jms/INVOICE_GENERATOR_CF</binding> ..etc..
The JNDI View mbean then shows me this bound into the global namespace:
+- applications (class: org.jnp.interfaces.NamingContext) | +- ig (class: org.jnp.interfaces.NamingContext) | | +- jms (class: org.jnp.interfaces.NamingContext) | | | +- INVOICE_GENERATOR_CF (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
So when the code does this:
Object temp = context.lookup(jndiFactoryName); if (temp instanceof XAQueueConnectionFactory) { factory = (XAQueueConnectionFactory) temp; } else { log.error("getXAQueueConnectionFactory: Could not cast the object " + temp.toString() + "to a XAQueueConnectionFactory class."); }
Sure enough, it logs this:
2009-04-28 16:01:27,226 ERROR [au.com.soul.common.utils.servicelocator.ServiceLocator] getXAQueueConnectionFactory: Could not cast the object org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl@665e81to a XAQueueConnectionFactory class.
Could someone please point me in the right direction?
thanks in advance,
Len