Thursday, June 16, 2011

Resolving XAER_NOTA : The XID is not valid

The below Error occurs if you are using two different JDBCConnection Pools for the same Oracle Database or two DataSources for the same pool. This post will help you understand and resolve the below issue.

Cause: java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_NOTA start() failed on resour
ce 'jdbc/TestDB': XAER_NOTA : The XID is not valid
oracle.jdbc.xa.OracleXAException
        at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:938)

As defined XA protocol requires all SQL statements for one and the same transaction branch be issued between an xa_start() and an xa_end() call. In a distributed transaction, an individual database represents one XAResource that will have one transaction branch in one distributed transaction. The WebLogic Server transaction manager considers every JDBC connection pool as a separate XAResource, i.e., it cannot evaluate if different connection pools or data sources point to the same database.

WebLogic Server makes sure that every call to one XAResource has the correct sequence of calls: xa_start, sql statements, and xa_end. Also WebLogic Server represents a multi-threading system, where different operations occur in a highly parallel environment. Consequently, calls to different XAResources like JDBC connection pools will happen concurrently. If two XA-Resources are defined for the same database, nested xa_start - xa_end pairs may result.

For example if there are two different ConnectionPools in one transaction, the calls may happen as follows: 
-- xa_start(NOFLAGS) to ConnectionPool-1 
-- sql statement for ConnectionPool-1
-- xa_start(JOIN) to ConnectionPool-2
-- sql statement for ConnectionPool-1
-- sql statement for ConnectionPool-2
-- xa_end() for ConnectionPool-2
-- xa_end() for ConnectionPool-

This scenario will work perfectly fine as long as ConnectionPool-1 and ConnectionPool-2 are pointing to different databases and therefore different resource managers which will complete Transaction smoothly. However, if ConnectionPool-1 and ConnectionPool-2 point to the same Oracle database, an Oracle issue will lead to the above exception.

Solution
If it is not possible to define only one connection pool for one database, using the Oracle OCI driver can be a solution for this problem, as it synchronizes xa_start calls.

Work Around
If you are facing this issue even after having one DataSource this work around shall work.
1. If you have not already done so, in the Change Center of the Administration Console, click "Lock & Edit"
2. In the left pane, click on the Data Sources under Services > JDBC > Data Sources.
 
3.  In the right pane, Click on your configured DataSource. In my case it is JDBC Data Source-1
4. In the Settings for JDBC Data Source-1 page, select Configuration > Transaction tab.
 
5. Click the Set XA Transaction Timeout check box flag and set the XA Transaction Timeout to 0.
 
6. Click Save and in the Change Center of the Administration Console, click "Activate Changes".
 
7. Restart all the WLS nodes targeted to this DataSource.
8. By completing steps1-6, the DataSource will now make of JTA Timeout specified under base_domain > Configuration > JTA
-- In the left pane, click on the domain name.

-- In the right pane, Select Configuration > JTA tab.


13 comments:

Anonymous said...

I don't even understand how I ended up right here, however I believed this post was once good. I don't realize who you might be but certainly you're going to a well-known blogger when you are not already. Cheers!

Here is my blog post Le Parfait Skin Care

Anonymous said...

Hi there, just became alert to your blog through Google,
and found that it's really informative. I'm going to watch out for brussels.
I'll appreciate if you continue this in future. Numerous people will be benefited from your writing. Cheers!

Feel free to visit my web-site - Power Precision Muscle building

Anonymous said...

Thanks for sharing your thoughts about build muscle tips.
Regards

Feel free to surf to my page Muscle Maximizer

Anonymous said...

Hi there, I enjoy reading all of your article. I wanted to write
a little comment to support you.

my website ... Online Home Careers Scam

Anonymous said...

Very good article! We are linking to this great post on our site.
Keep up the great writing.

My web site: puregce.info

Anonymous said...

Heya i'm for the first time here. I found this board and I find It really useful & it helped me out a lot. I hope to give something back and aid others like you helped me.

Also visit my page: Wrinkle cream

Anonymous said...

If you are going for best contents like me, simply visit this
web page every day for the reason that it presents quality
contents, thanks

My site; Test Force Extreme

Anonymous said...

Greate article. Keep posting such kind of information on your
blog. Im really impressed by your site.
Hi there, You've performed an excellent job. I'll definitely digg
it and individually recommend to my friends. I am sure they will
be benefited from this site.

my blog post: Saphire Ecig Review

Anonymous said...

I seriously love your website.. Great colors &
theme. Did you build this website yourself? Please reply back as I'm wanting to create my own personal site and want to know where you got this from or what the theme is named. Appreciate it!

Feel free to visit my web blog - muscle enhancers

Anonymous said...

Right here is the perfect webpage for everyone who would like to find
out about this topic. You realize so much its almost hard to argue with you (not that I actually would want to…HaHa).
You definitely put a new spin on a topic that's been written about for a long time. Excellent stuff, just excellent!

my web page: Test Force Xtreme Review

Anonymous said...

I could not resist commenting. Perfectly written!

Also visit my blog post ... Cambogia Extract

Anonymous said...

I really like your blog.. very nice colors & theme. Did you design this
website yourself or did you hire someone to do it for you?
Plz respond as I'm looking to design my own blog and would like to know where u got this from. appreciate it

Check out my site: Buy Anti Aging Cream

Anonymous said...

I really like your blog.. very nice colors &
theme. Did you create this website yourself or did you
hire someone to do it for you? Plz reply as I'm looking to design my own blog and would like to know where u got this from. thanks a lot

My webpage: Profit web system reviews