You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Ritu Kedia <RK...@saba.com> on 2004/06/22 14:55:27 UTC

AutoCommit Problem with the Connection returned by J2EEStore

I had reported this error some time back but forgot to pursue it, since I
did a local fix and moved ahead. This problem surfaced again today when I
tried to deploy the jakarta_slide code from CVS Head. 

Bug description: 
When Slide is deployed in JBoss App Server, the connections returned by the
J2EEStore have autocommit set to true. As a result the tx commits and
rollbacks fail and further call for a new transaction fails with the
following error:
17:39:26,796 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.common.Namespace - INFO - Loading namespace slide base data
17:39:26,843 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.transaction.SlideTransaction - WARNING - Rollback failure:
Resource manager org.apache.slide
.store.impl.rdbms.J2EEStore@1b55f2 Error code XA_HEURCOM in Transaction 1
xid main-1087906166828-1- in thread main
17:39:26,843 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.common.Namespace - INFO - Init namespace slide
configuration
17:39:26,906 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.common.Namespace - INFO - Import data into namespace slide
17:39:26,937 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.common.XMLUnmarshaller - INFO - Loading object /
17:39:26,953 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.transaction.SlideTransaction - WARNING - Enlist failure:
Resource manager org.apache.slide.s
tore.impl.rdbms.J2EEStore@1b55f2 Error code XAER_INVAL in Transaction 3 xid
main-1087906166906-3- in thread main
17:39:27,156 INFO  [STDOUT] 22 Jun 2004 17:39:27 -
org.apache.slide.transaction.SlideTransaction - WARNING - Enlist failure:
Resource manager org.apache.slide.s
tore.impl.rdbms.J2EEStore@1b55f2 Error code XAER_INVAL in Transaction 3 xid
main-1087906166906-3- in thread main
...... same error repeats several times

Atleast with JBoss it is not possible to declaratively set autocommit to
false on DB Connections. I had confirmed this with JBoss support(ref:
http://jboss.org/index.html?module=bb&op=viewtopic&t=48838). I have not
tested with Weblogic and Websphere.

Bug fix: Setting autocommit to false when returning the connection from
J2EEStore. This fix should not cause any problems on other app servers
either.

Patch: Please find attached the patch for J2EEStore. I hope someone could
look at this.

Regards,
Ritu
 <<autocmmit_patch.txt>> 




Re: AutoCommit Problem with the Connection returned by J2EEStore

Posted by Oliver Zeigermann <oz...@c1-fse.de>.
- Why don't you configure your datasource as tx-datasource? Doesn't this 
work?
- OT: You can also try to use SelectMethod=direct as someone reported 
this might be faster

Oliver

Ritu Kedia wrote:

> I had reported this error some time back but forgot to pursue it, since I
> did a local fix and moved ahead. This problem surfaced again today when I
> tried to deploy the jakarta_slide code from CVS Head. 
> 
> Bug description: 
> When Slide is deployed in JBoss App Server, the connections returned by the
> J2EEStore have autocommit set to true. As a result the tx commits and
> rollbacks fail and further call for a new transaction fails with the
> following error:
> 17:39:26,796 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
> org.apache.slide.common.Namespace - INFO - Loading namespace slide base data
> 17:39:26,843 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
> org.apache.slide.transaction.SlideTransaction - WARNING - Rollback failure:
> Resource manager org.apache.slide
> .store.impl.rdbms.J2EEStore@1b55f2 Error code XA_HEURCOM in Transaction 1
> xid main-1087906166828-1- in thread main
> 17:39:26,843 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
> org.apache.slide.common.Namespace - INFO - Init namespace slide
> configuration
> 17:39:26,906 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
> org.apache.slide.common.Namespace - INFO - Import data into namespace slide
> 17:39:26,937 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
> org.apache.slide.common.XMLUnmarshaller - INFO - Loading object /
> 17:39:26,953 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
> org.apache.slide.transaction.SlideTransaction - WARNING - Enlist failure:
> Resource manager org.apache.slide.s
> tore.impl.rdbms.J2EEStore@1b55f2 Error code XAER_INVAL in Transaction 3 xid
> main-1087906166906-3- in thread main
> 17:39:27,156 INFO  [STDOUT] 22 Jun 2004 17:39:27 -
> org.apache.slide.transaction.SlideTransaction - WARNING - Enlist failure:
> Resource manager org.apache.slide.s
> tore.impl.rdbms.J2EEStore@1b55f2 Error code XAER_INVAL in Transaction 3 xid
> main-1087906166906-3- in thread main
> ...... same error repeats several times
> 
> Atleast with JBoss it is not possible to declaratively set autocommit to
> false on DB Connections. I had confirmed this with JBoss support(ref:
> http://jboss.org/index.html?module=bb&op=viewtopic&t=48838). I have not
> tested with Weblogic and Websphere.
> 
> Bug fix: Setting autocommit to false when returning the connection from
> J2EEStore. This fix should not cause any problems on other app servers
> either.
> 
> Patch: Please find attached the patch for J2EEStore. I hope someone could
> look at this.
> 
> Regards,
> Ritu
>  <<autocmmit_patch.txt>> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: J2EEStore.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/J2EEStore.java,v
> retrieving revision 1.11
> diff -u -r1.11 J2EEStore.java
> --- J2EEStore.java	11 Feb 2004 11:30:21 -0000	1.11
> +++ J2EEStore.java	22 Jun 2004 12:49:35 -0000
> @@ -155,6 +155,10 @@
>      }
>  
>      protected Connection getNewConnection() throws SQLException {
> -        return ds.getConnection();
> +		Connection con = ds.getConnection();
> +		boolean autoCommit = con.getAutoCommit();
> +		if(autoCommit)
> +			con.setAutoCommit(false);
> +		return con;
>      }
>  }
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org