Tweaking Oracle XE for XA Transactions in JBoss 6

I’m currently testing an application in Oracle 10g XE environment and getting familiar with working with Oracle alongside JBoss AS 6 to support XA transactions. After configuring my XA datasource as per JBoss’s documentation, I started up the JBoss server only to come up with the ff exception.

ORA-12516: TNS:listener could not find available handler with matching protocol stack

As it turns out, it seems my settings for minimum connection pool size was more than what Oracle XE by default allows (i.e. 49). Thankfully, I found the perfect guide to solving this problem here. Thanks Andrew.

Having sweated that first part out, I restarted my application server again, only to get the next biggie.

ARJUNA-16027 Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException
 at oracle.jdbc.xa.OracleXAResource.recover( 

It turns out again that the current user that I used to access my XE database was not XA enabled, with no ability to perform 2 phase commits. So I logged into my sqlplus console and entered the following statements, making sure I connected as ‘sysdba’. Note: MYUSER is the name of the user used to perform the XA transactions.

grant select on pending_trans$ to MYUSER;
grant select on dba_2pc_pending to MYUSER;
grant select on dba_pending_transactions to MYUSER;
grant execute on dbms_system to MYUSER;


I smiled after that, because my app started up nicely. Let’s see what else Oracle has up its sleeves to terrorise my life with.

JBOSS AS 6 Startup: ConnectionFactory Not Bound

So here I was, minding my own business migrating my Spring based application from JBoss 5.1.0.GA to JBoss 6.1. On an ordinary day, JBoss 5 will have been fine for me (otherwise move straight to 7), but RHQ doesn’t sit nicely with JBoss 5, and I didn’t want to risk deploying a major application to a customer on the freshly cut JBoss 7.

I got a very nasty surprise when after creating my datasource definitions, configuring all my JMS queues, deploying my native libraries to their appropriate locations and starting up my server, I get the ff exception.

 javax.naming.NameNotFoundException: ConnectionFactory not bound

And yet when I looked at the JNDIView in the JMX console under http://localhost:8080/jmx-console, the ConnectionFactory was bound to the global namespace i.e. /ConnectionFactory and the “java” namespace i.e. java:/ConnectionFactory. Looking at the console, I then noticed the ff statements after the log statements showing my application had failed deployment.

16:36:38,045 INFO  [HornetQServerImpl] trying to deploy queue jms.queue.UpdateQueue

Hmm, it seems that the HornetQ inside JBoss 6 starts up the ConnectionFactory and queues/topics after everything else has started up, and not before. I still don’t know why JBoss designed it that way, seeing as some applications may need to immediately connect to JMS resources at startup.

A little “googling” about and I found how to make the JMS resources bootstrap before any web application is deployed. Simply look for the following file under your JBoss 6 installation. Replace my path with your appropriate locations.

K:\dev\ jboss-6.1.0.Final\server\default\deploy\jbossweb.sar\META-INF\jboss-beans.xml

Add the ff declarations as dependencies to the “WebServer” MBean, and you should be fine.




Now whip up your JBoss again, and you’ll notice that the queues/topics are deployed before any web application. You’re in business now.