WebSphere Application Server - Two phase commit in Message Bean

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Application Server > April 2005 > Two phase commit in Message Bean





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Two phase commit in Message Bean

2005-04-06, 5:58 pm

Hi,

I have created a Message Driven Bean for a process and I am using session bean to update the information into DB2 database in OS390 (DB2 v 7.3). During the MDB testing, I got an error

WTRN0063E: An illegal attempt to commit a one phase capable resource with existing two phase capable resources has occurred while updating the information into DB2 database from Message Bean.

We are using Websphere 5.1.2

We cannot use XA support driver COM.ibm.db2.jdbc.DB2XADataSource in our application, since our database DB2 v7.3 (running in OS390) does not support this driver.

I also saw that in IBM forum, this was an issue till Websphere v5.0, but we are using Websphere v5.1.2.

Please help.

Thanks!

Natraj.

Paul Ilechko

2005-04-06, 5:58 pm

senthil.k.natarajan@supervalu.com wrote:
> Hi,
>
> I have created a Message Driven Bean for a process and I am using session bean to update the information into DB2 database in OS390 (DB2 v 7.3). During the MDB testing, I got an error
>
> WTRN0063E: An illegal attempt to commit a one phase capable resource with existing two phase capable resources has occurred while updating the information into DB2 database from Message Bean.
>
> We are using Websphere 5.1.2
>
> We cannot use XA support driver COM.ibm.db2.jdbc.DB2XADataSource in our application, since our database DB2 v7.3 (running in OS390) does not support this driver.
>
> I also saw that in IBM forum, this was an issue till Websphere v5.0, but we are using Websphere v5.1.2.


If you have the MDB as transaction attribute SUPPORTS, it's going to try
and do a 2PC. this means you either need an XA driver, or you have to
change to NOT SUPPORTED and deal with potential lost messages on rollback.

David Currie

2005-04-08, 5:53 pm

> If you have the MDB as transaction attribute SUPPORTS, it's going to try
> and do a 2PC. this means you either need an XA driver, or you have to
> change to NOT SUPPORTED and deal with potential lost messages on rollback.


Think this should say "Required" not "Supports". "Required" and
"NotSupported" are the only valid values for the transaction on an MDB.
In WAS, "Required" is the default and will result in a global
transaction being started before the message is received. As Paul says,
you could change this to "NotSupported" to avoid the global transaction.
Alternatively, you could leave the MDB as "Required" and change the
session bean to "NotSupported" which would cause the transaction to be
suspended again before calling the session bean. Not much point in
doing this though unless the MDB is touching some other transactional
resources which would then still be co-ordinated with the receipt of the
message.

Regards,
David

PS In WAS 6 you could enable Last Participant Support to allow the use
of a single non-XA capable resource in a global transaction.
Ben_

2005-04-08, 5:53 pm

Hello,

Additional question: what would be the effect of disabling XA support on the
Queue factory ?

Thx.


2005-04-08, 5:53 pm

I already tried disabling XA Support option in the WAS Queue connection factory setup and still it is failing.

Error from the console:

[4/6/05 14:18:11:503 CDT] 2d431d43 TransactionIm E WTRN0062E: An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction.

[4/6/05 14:18:11:643 CDT] 2d431d43 LocalTransact E J2CA0030E: Method enlist caught java.lang.IllegalStateException

Paul Ilechko

2005-04-08, 5:53 pm

David Currie wrote:

>
>
> Think this should say "Required" not "Supports".


Yes, that was a careless mistake.

David Currie

2005-04-11, 7:53 am

senthil.k.natarajan@supervalu.com wrote:
> I already tried disabling XA Support option in the WAS Queue connection factory setup and still it is failing.
>
> Error from the console:
>
> [4/6/05 14:18:11:503 CDT] 2d431d43 TransactionIm E WTRN0062E: An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction.
>
> [4/6/05 14:18:11:643 CDT] 2d431d43 LocalTransact E J2CA0030E: Method enlist caught java.lang.IllegalStateException
>


Which is what you would expect. Disabling XA support doesn't prevent
the application server from trying to enlist the connection in the
transaction, it just means that the JMS provider is enlisted as a
one-phase capable XAResource that uses Session.commit/rollback rather
than a full two-phase capable XAResource. Having two non-XA capable
resources (JMS and JDBC) in a global transaction is even more of a
problem than having just one!

Regards,
David

2005-04-18, 5:54 pm

I changed the MDB type to Bean managed instead of Container managed bean and it works now!!! I am not getting the two phase commit issue now. I didn't make any changes to the code at all..

Is there any reason for why it worked for Bean managed?

Thanks!

Senthil.




Paul Ilechko

2005-04-18, 8:47 pm

senthil.k.natarajan@supervalu.com wrote:

> I changed the MDB type to Bean managed instead of Container managed bean and it works now!!! I am not getting the two phase commit issue now. I didn't make any changes to the code at all..
>
> Is there any reason for why it worked for Bean managed?
>
> Thanks!
>
> Senthil.
>
>
>
>

Because the read from the queue is no longer part of the transaction.
This may not be what you want, you can lose messages this way.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com