geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "lilisacat" <lilisa...@gmail.com>
Subject Re: Re: XA_RBROLLBACK Exception when using Derby in transaction.roolback()
Date Thu, 12 Aug 2010 01:10:07 GMT
Hi David, 
    Below is the stack trance: 
2010-08-12 09:21:23,585 WARN  [Transaction] Error ending association for XAResource org.apache.geronimo.transaction.manager.WrapperNamedXAResource@1e77734;
transaction will roll back. XA error code: 100
org.apache.derby.client.am.XaException: XA_RBROLLBACK : Error executing a XAResource.end(),
server returned XA_RBROLLBACK.
at org.apache.derby.client.net.NetXAResource.throwXAException(Unknown Source)
at org.apache.derby.client.net.NetXAResource.end(Unknown Source)
at org.apache.geronimo.transaction.manager.WrapperNamedXAResource.end(WrapperNamedXAResource.java:53)
at org.apache.geronimo.transaction.manager.TransactionImpl.endResources(TransactionImpl.java:570)
at org.apache.geronimo.transaction.manager.TransactionImpl.endResources(TransactionImpl.java:549)
at org.apache.geronimo.transaction.manager.TransactionImpl.rollback(TransactionImpl.java:480)
at org.apache.geronimo.transaction.manager.TransactionManagerImpl.rollback(TransactionManagerImpl.java:265)
at org.apache.geronimo.transaction.GeronimoUserTransaction.rollback(GeronimoUserTransaction.java:74)
at org.apache.geronimo.sample.servlet.DoTransfer.doPost(DoTransfer.java:108)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:700)
at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
at org.apache.geronimo.tomcat.valve.ProtectedTargetValve.invoke(ProtectedTargetValve.java:53)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:146)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:402)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:254)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:267)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:245)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:260)
at org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:214)
at org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:344)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.derby.client.am.SqlException: Error executing a XAResource.end(), server
returned XA_RBROLLBACK.
at org.apache.derby.client.net.NetXAResource.xaRetValErrorAccumSQL(Unknown Source)
... 30 more

Thanks!


2010-08-12 



lilisacat 



发件人: David Jencks 
发送时间: 2010-08-12  00:44:04 
收件人: dev 
抄送: 
主题: Re: XA_RBROLLBACK Exception when using Derby in transaction.roolback() 
 
You should be able to use two datasources on one database.  It's a bit odd but we should be
able to handle it.  It's more plausible to get in this situation with a jms provider where
you have inbound and outbound messaging, geronimo will treat the inbound XAResource and outbound
XAResource as different.


It's possible that this is affected by whether what derby returns from isSameRM.  



I suspect this is from the second branch, derby is telling the tm that the tx has already
been rolled back from the first branch.


It would be a lot easier to investigate this if you could provide a complete exception stack
trace.


thanks!
david jencks


On Aug 11, 2010, at 8:30 AM, lilisacat wrote:


I use
DataSourceDefinition(name="java:app/SHAcc") link to url="jdbc:derby://localhost:1527/SHAcc",
DataSourceDefinition(name="java:app/BJAcc")link to another url="jdbc:derby://localhost:1527/BJAcc",
so they point to two different databases.
    The transaction can commit correctly.

    The problem appears when I call the transaction.setRollBackOnly() method, transaction
will rollback in fact,
but the server say: 
org.apache.derby.client.am.XaException: XA_RBROLLBACK : Error executing a XAResource.end(),
server returned XA_RBROLLBACK

2010-08-11



lilisacat



发件人: sghayal
发送时间: 2010-08-11  21:03:11
收件人: dev
抄送:
主题: Re: XA_RBROLLBACK Exception when using Derby in transaction.roolback()
U r using wrong url. Both the url point to same database.

This is what seems to be happening. A single transaction has been started which is being committed
twice.

If using xa u need two physically different databases.

Hope this helps.

Cheers,

Sandip
Sent from my “contract free” BlackBerry® smartphone on the WIND network.



From: "lilisacat" <lilisacat@gmail.com>
Date: Wed, 11 Aug 2010 15:15:41 +0800
To: dev<dev@geronimo.apache.org>
ReplyTo: dev@geronimo.apache.org
Subject: XA_RBROLLBACK Exception when using Derby in transaction.roolback()


Hi,
    I encournter a problem when run the app in the G-3.0-SANPSHOT.
    In the app, I used Datasource DS-A and Datasource DS-B to link two derby database.
If UserTransaction.rollback() called, the server occured error:
org.apache.derby.client.am.XaException: XA_RBROLLBACK : Error executing a XAResource.end(),
server returned XA_RBROLLBACK.
   
Here is the details of two Datasource:
//DataSourceSH
@DataSourceDefinition(name="java:app/SHAcc",
   className="org.apache.derby.jdbc.ClientXADataSource",
   url="jdbc:derby://localhost:1527/SHAcc",
   user="system",
   databaseName="SHAcc",
   transactional=true,
   maxPoolSize=10,
   properties = {"createDatabase = create"})
//DataSourceBJ
@DataSourceDefinition(name="java:app/BJAcc",
   className="org.apache.derby.jdbc.ClientXADataSource",
   url="jdbc:derby://localhost:1527/BJAcc",
   user="system",
   databaseName="BJAcc",
   transactional=true,
   maxPoolSize=10,
   properties = {"createDatabase = create"})

In the Servlet, I used two datasources as following:
Context initContext = new InitialContext();
tx = (UserTransaction)initContext.lookup("java:comp/UserTransaction");
// Start a transaction
// First, use DataSourceSH
ds = (javax.sql.DataSource) initContext.lookup("java:app/SHAcc");
//get connection with database: SHAcc
//do some update on database: SHAcc
if(failFlag)
            {tx.setRollBackOnly();}
// Second, use DataSourceBJ 
ds = (javax.sql.DataSource) initContext.lookup("java:app/BJAcc");
//get connection with database: BJAcc
//do some update on database: BJAcc
// commit all the operations
tx.commit();
}
        catch(Exception e){
if(tx!=null){
try{
// rollback the operations
tx.rollback();
System.out.println("catch: roll back success.");}
catch(Exception e1){
System.out.println("catch: roll back fail.");}
}
System.out.println("catch: " + e.getClass() + "; " + e.getMessage()+"");
}......

    I have no idea why Error executing a XAResource.end() if tx.rollback() happens?

 Thanks !
2010-08-11



Lisa
Mime
View raw message