[jboss-user] [JBoss Messaging] - Re: Problems at Startup with MySQL 5 and XAConnection

felipeal do-not-reply at jboss.com
Thu Aug 31 13:29:01 EDT 2006


Hi again,

First of all, thanks for your quick reply and sorry for the delay on mine's, but the link I was refreshing didn't show your reply, neither did I get an email notifying me about it...

Anyway, your explanation was very good - even though I already knew most of the 2PC/XA stuff (and was more interested to know how JBoss Messaging could participate on a global transaction using a non-XA datasource), it was a very explanation to get logged in the forum :-)

Now, here are a couple more comments...
 
"timfox" wrote : 
  | Ok, so in a nutshell this is what happens when use a JBoss Messaging (you meant JBoss Messaging not JBoss MQ, right?) 
  | 

I thought it was still called JBossMQ and that Jboss Messaging was the name of the next generation's...

"timfox" wrote : 
  | and you are using an JCA XA datasource (this one *does* need to do be XA since you 
  | 

Hmm, that brings the problem back to its roots: how to get a XADatasource from MySQL 5.0 - I will talk more about this issue later on.

"timfox" wrote : 
  | are using the XA capabilities of your database - make sure your db does have XA capabilities! Some don't)
  | 

The MySQL 5 + Connector/J 5.1 combo is supposed to  XA compliant; at least I can run the following commands in the mysql console:

 xa start 'a';
// issues command
 xa end 'a';
 xa prepare 'a';
 xa commit 'a'; // or xa rollback 'a'

"timfox" wrote : 
  | through the logging the transaction manager will do (if you are using JBoss TS) - since it's not relevant to the question.)
  | 
Agreed...

"timfox" wrote : 
  | (Eventually we will log using JBoss TS - but that is a different story).
  | 
By JBoss TS do you meand the current stuff or Arjuna's ?

"timfox" wrote : 
  | The app server then calls prepare on XAResource2 - what happens now depends on the implementation of your database. But assuming it supports XA properly, 
  | 
Funny, it worked on MySQL, even though I didn't use a XAResource. I mean, my DB connection is configured as <local-tx> instead of <xa-datasource> (in fact, it's the same local-tx datasource used by the JMS RA).

"timfox" wrote : 
  | in the database, so we just update it's status to "committed". This happens in a single JDBC transaction
  | 
My guess is that the only drawback happens when this simple transaction fails (for instance, due to a lock or error in the database), i.e., from the point of the view of the global transaction, the JMS transaction branch is committed (as the prepare phase returned ok), so somehow JBM or JBTS will have to guarantee the messages are written in the database).

"timfox" wrote : 
  | Next, "commit" is called onn XAResource2. The database doesn't something internal to its implementation that results in the data ending up in the committed state.
  | 
The database could also have an issue doint that internal stuff, so the above comment is not that relevant...

"timfox" wrote : 
  | So as you can see there is no need for JBM to need an XA capable database in order to provide a fully functioning XAResource.
  | This is by design:
  | 
That was a clever - and simple - design. Even considering the drawback I mentioned above , as it would be  a problem even if JBM relied on a XA-capable datasource - the only difference is that JBM would be 'delegating away' the issue to the database...

"timfox" wrote : 
  | It definitely should work. If it doesn't please file a bug report.
  | 

Yes it worked, even more than it should (as the connection to my DB is not XA). The only issue I had was how to get an reference to the javax:/JmsXA from Spring, but that's another problem (basically, I was getting a "not bound exception' when the BeanFactory tried to get the object from JNDI, at the webapp startup; but if I did a lookup on the servlet method, it worked. My guess is this is either a Spring bug or JBoss does not make that object visible to my webapp on startup).

Now, back to the original MySQL issue, the problem still remains: how to configure a XA datasource for a MySQL database on JBoss. I know this is not exactly an issue for the JBoss Messaging forum, but using JBM is the easiest way to reproduce the problem: it's just a matter of setting the JMS xml files to use such datasource and waiting to JBoss to fail on startup... I will fill a Jira issue regarding it (and explaining the whole situation), ok?

Thanks again,

-- Felipe










View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968715#3968715

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968715



More information about the jboss-user mailing list