Thanks for that. Basically I checked out the 3_0_0 branch, and built it, and couldn't even get my non xa application (which works on 3.0.0 final release) working - I was getting NoSuchMethodErrors from the ear deployer.
I guess I was doing something wrong and it was late and I was in a rush so I'd thought it might just be easier to patch the files directly onto our working codebase, hence the question. I shall try again tomorrow with a clearer head and see if I get the same effect ----- Original Message ----- From: "Igor Fedorenko" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, June 18, 2002 9:18 PM Subject: Re: [JBoss-user] XATxConnectionManager with Oracle? > Tim, > > Basically, I did two things (see attached diff) > > 1. In > connector/src/main/org/jboss/resource/adapter/jdbc/xa/XAManagedConnection.ja va > I added caching of XAResource > > 2. In server/src/main/org/jboss/tm/XidImpl.java I changed > getGlobalTransactionId() and getBranchQualifier() to always return > 64-byte arrays. Devid reinterpreted this change slightly, he added xid > factory which can be configured to create correct xids (I mean, correct > from oracle's point of view). > > You should be able to apply the diff to JBoss_3_0_0 (cvs -z3 co > -rJBoss_3_0_0) which I assume corresponds to jboss 3.0. > > Btw, what are these "real problems" you are talking about? Are they > related to setting oracle xa driver or Branch_3_0 has some other issues? > > Tim wrote: > > Hi Igor- > > > > Could you tell me which files were added/modified in the patch, because > > we're having some real problems getting the cvs version to run, and we > > really need the xa transactions? > > > > Thanks > > > > > > ----- Original Message ----- > > From: "Igor Fedorenko" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, June 17, 2002 3:51 PM > > Subject: Re: [JBoss-user] XATxConnectionManager with Oracle? > > > > > > > >>David, > >> > >>I checked Branch_3_0 and it seemed to work. I completely agree that > >>XidFactory is more elegant and flexible solution then hardcoded change > >>to XidImpl. One suggestion though -- I would add comment about > >>XidFactory mbean and its "Pad" attribute into sample > >>oracle-xa-services.xml, otherwise it is not obvious how to configure > >>this thing and "invalid transaction id" exception thrown during > >>conn.close() does not add clarity ;-) > >> > >>David Jencks wrote: > >> > >>>Many many thanks. > >>> > >>>I checked in the config file and applied the XAManagedConnection patch. > >>>Instead of applying the changes to Xid handling I changed Xid creation > >> > > to > > > >>>be done through a factory mbean. You can configure the factory with the > >>>"pad" boolean property to specify if the xid's are of maximum size. In > >>>jboss 3, this mbean config is in the main jboss-service.xml file. In > >> > > 3.1 > > > >>>it will be in a separate tm-service.xml file. > >>> > >>>Can you please check whether or not my reinterpretation of the patches > >>>still works? If so I will clean up the XidFactory interface a bit and > >> > > port > > > >>>the changes to 3.1 as well. > >>> > >>>Thanks! > >>> > >>>david jencks > >>> > >>>On 2002.06.14 17:03:56 -0400 Igor Fedorenko wrote: > >>> > >>> > >>>>Attached, please fine a patch which fixes problems with Oracle XA driver > >>>>I > >>>>have described earlier and example configuration file. The patch is > >>>>against > >>>>JBoss_3_0_0 cvs tag (branch?). Hope this helps. > >>>> > >>>>PS: sorry for html posting > >>>> > >>>>-----Original Message----- > >>>>From: Igor Fedorenko [mailto:[EMAIL PROTECTED]] > >>>>Sent: Friday, June 14, 2002 4:06 PM > >>>>To: '[EMAIL PROTECTED]' > >>>>Subject: RE: [JBoss-user] XATxConnectionManager with Oracle? > >>>> > >>>> > >>>>Thanks for a helpful hint, David. As you correctly guessed my test ssb > >>>>was > >>>>leaking sql connections. I'll post my patch and config files here > >>>>shortly. > >>>> > >>>> > >>>>>-----Original Message----- > >>>>>From: David Jencks [mailto:[EMAIL PROTECTED]] > >>>>>Sent: Friday, June 14, 2002 2:01 PM > >>>>>To: [EMAIL PROTECTED] > >>>>>Subject: Re: [JBoss-user] XATxConnectionManager with Oracle? > >>>>> > >>>>> > >>>>>Thanks for your work on this. Please post the results when you are > >>>>>satisfied. IMO the entire xa wrapper needs replacing which I > >>>>>unfortunately > >>>>>won't have time for soon. I'm not sure if associateConnection can be > >>>>>implemented easily. You can avoid it being called if you always close > >>>>>connection handles before calling other ejb methods (through > >>>>>home or remote > >>>>>interfaces) (and do not hold connections over method > >>>>>boundaries). So, try > >>>>>this: > >>>>> > >>>>>Connection c = myds.getConnection(); > >>>>>//do something > >>>>>c.close() > >>>>>myotherRemoteInterface.doSomethingElse(); > >>>>>c = myds.getConnection(); > >>>>>//do the rest of your work > >>>>>c.close(); > >>>>> > >>>>>david jencks > >>>>> > >>>>>On 2002.06.14 13:35:16 -0400 Igor Fedorenko wrote: > >>>>> > >>>>> > >>>>>>I spent last two days trying to make this work and it looks > >>>>> > >>>>>like there > >>>>> > >>>>> > >>>>>>are > >>>>>>number of issues with both oracle xa datasource and jboss > >>>>> > >>>>>itself. I am > >>>>> > >>>>> > >>>>>>getting close to have this configuration work (it's oracle > >>>>> > >>>>>8.1.7.3 in my > >>>>> > >>>>> > >>>>>>case but this should not make big difference). Problems that I've > >>>>>>seen/fixed > >>>>>>so far > >>>>>> > >>>>>>1. Oracle xa driver returns difference XAResource for each call to > >>>>>>XAConnection.getXAResource (see specs jdbc 2.0, section 7.2.2 why it > >>>>>>should > >>>>>>not). This problem causes "xaRes not enlisted". Fixed > >>>>> > >>>>>XAManagedConnection > >>>>> > >>>>> > >>>>>>to > >>>>>>cache XAResource, this fix should not break anything else. > >>>>>> > >>>>>>2. Although oracle xa driver accepts non-oracle Xid object, > >>>>> > >>>>>it seems to > >>>>> > >>>>> > >>>>>>require that both getGlobalTransactionId and > >>>>> > >>>>>getBranchQualifier always > >>>>> > >>>>> > >>>>>>return byte[64], otherwise it throws "invalid transaction id" during > >>>>>>XAResource.end. Fixed XidImpl to return such arrays, not > >>>>> > >>>>>sure if it will > >>>>> > >>>>> > >>>>>>work with all resource managers. > >>>>> > >>>><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> > >>>><HTML> > >>>><HEAD> > >>>><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> > >>>><META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45"> > >>>><TITLE>RE: [JBoss-user] XATxConnectionManager with Oracle?</TITLE> > >>>></HEAD> > >>>><BODY> > >>>> > >>>><P><FONT SIZE=2>Attached, please fine a patch which fixes problems with > >>>>Oracle XA driver I have described earlier and example configuration > >>> > > file. > > > >>>>The patch is against JBoss_3_0_0 cvs tag (branch?). Hope this > >>>>helps.</FONT></P> > >>>> > >>>><P><FONT SIZE=2>PS: sorry for html posting</FONT> > >>>></P> > >>>> > >>>><P><FONT SIZE=2>-----Original Message-----</FONT> > >>>><BR><FONT SIZE=2>From: Igor Fedorenko [<A > >>> > >>>HREF="mailto:[EMAIL PROTECTED]">mailto:ifedorenko@thinkdynamic s > >> > > .com</A>]</FONT> > > > >>>><BR><FONT SIZE=2>Sent: Friday, June 14, 2002 4:06 PM</FONT> > >>>><BR><FONT SIZE=2>To: '[EMAIL PROTECTED]'</FONT> > >>>><BR><FONT SIZE=2>Subject: RE: [JBoss-user] XATxConnectionManager with > >>>>Oracle?</FONT> > >>>></P> > >>>><BR> > >>>> > >>>><P><FONT SIZE=2>Thanks for a helpful hint, David. As you correctly > >>>>guessed my test ssb was leaking sql connections. I'll post my patch and > >>>>config files here shortly.</FONT></P> > >>>> > >>>><P><FONT SIZE=2>> -----Original Message----- </FONT> > >>>><BR><FONT SIZE=2>> From: David Jencks [<A > >>> > >>>HREF="mailto:[EMAIL PROTECTED]">mailto:davidjencks@directvi n > >> > > ternet.com</A>] > > > >>>></FONT> > >>>><BR><FONT SIZE=2>> Sent: Friday, June 14, 2002 2:01 PM </FONT> > >>>><BR><FONT SIZE=2>> To: [EMAIL PROTECTED] </FONT> > >>>><BR><FONT SIZE=2>> Subject: Re: [JBoss-user] XATxConnectionManager > >>>>with Oracle? </FONT> > >>>><BR><FONT SIZE=2>> </FONT> > >>>><BR><FONT SIZE=2>> </FONT> > >>>><BR><FONT SIZE=2>> Thanks for your work on this. Please post the > >>>>results when you are </FONT> > >>>><BR><FONT SIZE=2>> satisfied. IMO the entire xa wrapper needs > >>>>replacing which I </FONT> > >>>><BR><FONT SIZE=2>> unfortunately </FONT> > >>>><BR><FONT SIZE=2>> won't have time for soon. I'm not sure if > >>>>associateConnection can be </FONT> > >>>><BR><FONT SIZE=2>> implemented easily. You can avoid it being > >>>>called if you always close </FONT> > >>>><BR><FONT SIZE=2>> connection handles before calling other ejb > >>> > > methods > > > >>>>(through </FONT> > >>>><BR><FONT SIZE=2>> home or remote </FONT> > >>>><BR><FONT SIZE=2>> interfaces) (and do not hold connections over > >>>>method </FONT> > >>>><BR><FONT SIZE=2>> boundaries). So, try </FONT> > >>>><BR><FONT SIZE=2>> this: </FONT> > >>>><BR><FONT SIZE=2>> </FONT> > >>>><BR><FONT SIZE=2>> Connection c = myds.getConnection(); </FONT> > >>>><BR><FONT SIZE=2>> //do something </FONT> > >>>><BR><FONT SIZE=2>> c.close() </FONT> > >>>><BR><FONT SIZE=2>> myotherRemoteInterface.doSomethingElse(); </FONT> > >>>><BR><FONT SIZE=2>> c = myds.getConnection(); </FONT> > >>>><BR><FONT SIZE=2>> //do the rest of your work </FONT> > >>>><BR><FONT SIZE=2>> c.close(); </FONT> > >>>><BR><FONT SIZE=2>> </FONT> > >>>><BR><FONT SIZE=2>> david jencks </FONT> > >>>><BR><FONT SIZE=2>> </FONT> > >>>><BR><FONT SIZE=2>> On 2002.06.14 13:35:16 -0400 Igor Fedorenko wrote: > >>>></FONT> > >>>><BR><FONT SIZE=2>> > I spent last two days trying to make this > >>> > > work > > > >>>>and it looks </FONT> > >>>><BR><FONT SIZE=2>> like there </FONT> > >>>><BR><FONT SIZE=2>> > are </FONT> > >>>><BR><FONT SIZE=2>> > number of issues with both oracle xa > >>>>datasource and jboss </FONT> > >>>><BR><FONT SIZE=2>> itself. I am </FONT> > >>>><BR><FONT SIZE=2>> > getting close to have this configuration work > >>>>(it's oracle </FONT> > >>>><BR><FONT SIZE=2>> 8.1.7.3 in my </FONT> > >>>><BR><FONT SIZE=2>> > case but this should not make big > >>> > > difference). > > > >>>>Problems that I've </FONT> > >>>><BR><FONT SIZE=2>> > seen/fixed </FONT> > >>>><BR><FONT SIZE=2>> > so far </FONT> > >>>><BR><FONT SIZE=2>> > </FONT> > >>>><BR><FONT SIZE=2>> > 1. Oracle xa driver returns difference > >>>>XAResource for each call to </FONT> > >>>><BR><FONT SIZE=2>> > XAConnection.getXAResource (see specs jdbc > >>>>2.0, section 7.2.2 why it </FONT> > >>>><BR><FONT SIZE=2>> > should </FONT> > >>>><BR><FONT SIZE=2>> > not). This problem causes "xaRes not > >>>>enlisted". Fixed </FONT> > >>>><BR><FONT SIZE=2>> XAManagedConnection </FONT> > >>>><BR><FONT SIZE=2>> > to </FONT> > >>>><BR><FONT SIZE=2>> > cache XAResource, this fix should not break > >>>>anything else. </FONT> > >>>><BR><FONT SIZE=2>> > </FONT> > >>>><BR><FONT SIZE=2>> > 2. Although oracle xa driver accepts > >>>>non-oracle Xid object, </FONT> > >>>><BR><FONT SIZE=2>> it seems to </FONT> > >>>><BR><FONT SIZE=2>> > require that both getGlobalTransactionId and > >>>></FONT> > >>>><BR><FONT SIZE=2>> getBranchQualifier always </FONT> > >>>><BR><FONT SIZE=2>> > return byte[64], otherwise it throws > >>>>"invalid transaction id" during </FONT> > >>>><BR><FONT SIZE=2>> > XAResource.end. Fixed XidImpl to return such > >>>>arrays, not </FONT> > >>>><BR><FONT SIZE=2>> sure if it will </FONT> > >>>><BR><FONT SIZE=2>> > work with all resource managers. </FONT> > >>>></P> > >>>> > >>>><P><FONT FACE="Arial" SIZE=2 COLOR="#000000"></FONT><FONT FACE="Arial" > >>>>SIZE=2 COLOR="#000000"></FONT> > >>>> > >>>></BODY> > >>>></HTML> > >>>> > >>>_______________________________________________________________ > >>> > >>>Sponsored by: > >>>ThinkGeek at http://www.ThinkGeek.com/ > >>>_______________________________________________ > >>>JBoss-user mailing list > >>>[EMAIL PROTECTED] > >>>https://lists.sourceforge.net/lists/listinfo/jboss-user > >> > >> > >> > >>_______________________________________________________________ > >> > >>Sponsored by: > >>ThinkGeek at http://www.ThinkGeek.com/ > >>_______________________________________________ > >>JBoss-user mailing list > >>[EMAIL PROTECTED] > >>https://lists.sourceforge.net/lists/listinfo/jboss-user > >> > > > > > > > > > > -------------------------------------------------------------------------- -- > > Bringing you mounds of caffeinated joy > > >>> http://thinkgeek.com/sf <<< > > > > _______________________________________________ > > JBoss-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/jboss-user > > ---------------------------------------------------------------------------- ---- > Index: connector/src/main/org/jboss/resource/adapter/jdbc/xa/XAManagedConnection.ja va > =================================================================== > RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/adapter/jdbc/xa/XAManaged Connection.java,v > retrieving revision 1.2 > diff -u -r1.2 XAManagedConnection.java > --- connector/src/main/org/jboss/resource/adapter/jdbc/xa/XAManagedConnection.ja va 1 Dec 2001 18:08:18 -0000 1.2 > +++ connector/src/main/org/jboss/resource/adapter/jdbc/xa/XAManagedConnection.ja va 14 Jun 2002 20:35:44 -0000 > @@ -30,6 +30,7 @@ > { > private XAConnection con; > private XADataSource source; > + private XAResource res; > private int transactionIsolation; > > /* > @@ -70,12 +71,21 @@ > * @return The XAResource value > * @exception javax.resource.ResourceException Description of Exception > */ > - public XAResource getXAResource() > - throws javax.resource.ResourceException > + public synchronized XAResource getXAResource() > + // ifedorenko remove synchronized if it does not make sense here > + throws javax.resource.ResourceException > { > try > { > - return con.getXAResource(); > + // ifedorenko > + // Cache XAResource as a workaround for a bug in oracle xa driver > + // which returns a different XAResource for each getXAResource call > + // (see JDBC 2.0 spec, section 7.2.2 for a reason why it should not). > + if (res == null) > + { > + res = con.getXAResource(); > + } > + return res; > } > catch (SQLException e) > { > Index: server/src/main/org/jboss/tm/XidImpl.java > =================================================================== > RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/tm/Attic/XidImpl.java,v > retrieving revision 1.14 > diff -u -r1.14 XidImpl.java > --- server/src/main/org/jboss/tm/XidImpl.java 12 Dec 2001 22:12:18 -0000 1.14 > +++ server/src/main/org/jboss/tm/XidImpl.java 14 Jun 2002 20:35:52 -0000 > @@ -144,7 +144,15 @@ > */ > public byte[] getGlobalTransactionId() > { > - return (byte[])globalId.clone(); > + // ifedorenko > + // Oracle xa driver throws XAException.XAER_NOTA (The XID is not valid) > + // if returned value does not have some padding zeros. > + // I do not know what the limitation is but their examples seem to > + // always use 64 byte arrays. I checked that JBossMQ accepts such > + // ids but do not know if other resource managers do. > + byte[] result = new byte[Xid.MAXGTRIDSIZE]; > + System.arraycopy(globalId, 0, result, 0, globalId.length); > + return result; > } > > /** > @@ -152,10 +160,10 @@ > */ > public byte[] getBranchQualifier() > { > - if (branchId.length == 0) > - return branchId; // Zero length arrays are immutable. > - else > - return (byte[])branchId.clone(); > + // ifedorenko see my comments above > + byte[] result = new byte[Xid.MAXBQUALSIZE]; > + System.arraycopy(branchId, 0, result, 0, branchId.length); > + return result; > } > > /** > ---------------------------------------------------------------------------- Bringing you mounds of caffeinated joy >>> http://thinkgeek.com/sf <<< _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user