-
15. Re: unable to commit with JBoss 3.2.2
fral Oct 29, 2003 4:01 AM (in response to juergenschwarz)Ok, I'll try it. I have to download the source first. I have used the binary distribution so far. I'll check with people working with our XA support to see if we support it.
Regards,
Fredrik -
16. Re: unable to commit with JBoss 3.2.2
adrian.brock Oct 29, 2003 4:01 AM (in response to juergenschwarz)That should be MS SQL not My SQL :-)
Regards,
Adrian -
17. Re: unable to commit with JBoss 3.2.2
fral Oct 29, 2003 4:16 AM (in response to juergenschwarz)Adrian,
It should work with Mimer SQL. We have tried to implement all of XA in the server, and to have it all usable from all our client APIs, including our level 4 JDBC-driver.
I will try to test the patch later on today/night.
Regards,
Fredrik -
18. Re: unable to commit with JBoss 3.2.2
fral Oct 29, 2003 7:15 AM (in response to juergenschwarz)Adrian,
I have tested your patch now.
I ran 100 concurrent threads (with jakarta jmeter) with <track-connection-by-tx>false</track-connection-by-tx> without problems.
Regards,
Fredrik -
19. Re: unable to commit with JBoss 3.2.2
naycon Nov 2, 2003 11:02 AM (in response to juergenschwarz)Hi,
I'm having a _similar_ problem with jboss 3.2.2RC4.
I can't believe it's a bug as what I'm doing should be pretty straight forward. I've applied the suggested patch but the exception is actually being thrown at the line above the one adrian mentioned (where it tries to end the resource). The XID is reporting invalid (-4).
Here's a stacktrace, everyone likes a stacktrace (would attach but forms broken!):
17:12:34,512 WARN [TransactionImpl] XAException: tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=dave//19, BranchQual=] errorCode=XAER_NOTA
oracle.jdbc.xa.OracleXAException
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1159)
at oracle.jdbc.xa.client.OracleXAResource.end(OracleXAResource.java:471)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.end(XAManagedConnection.java:155)
at org.jboss.tm.TransactionImpl.endResource(TransactionImpl.java:1193)
at org.jboss.tm.TransactionImpl.endResources(TransactionImpl.java:1266)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:398)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:277)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:484)
at org.jboss.ejb.Container.invoke(Container.java:720)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
17:12:34,582 WARN [TransactionImpl] xa error: -4 (The XID is not valid.); oracle error: 24756; oracle sql error: 0;
oracle.jdbc.xa.OracleXAException
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1159)
at oracle.jdbc.xa.client.OracleXAResource.end(OracleXAResource.java:471)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.end(XAManagedConnection.java:155)
at org.jboss.tm.TransactionImpl.endResource(TransactionImpl.java:1193)
at org.jboss.tm.TransactionImpl.endResources(TransactionImpl.java:1266)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:398)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:277)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:484)
at org.jboss.ejb.Container.invoke(Container.java:720)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
17:12:34,673 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract crdb.DistTranRemote crdb.DistTranHome.findByPrimaryKey(java.lang.String) throws javax.ejb.FinderException,java.rmi.RemoteException,javax.ejb.ObjectNotFoundException, causedBy:
org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=dave//19, BranchQual=] status=STATUS_NO_TRANSACTION; - nested throwable: (oracle.jdbc.xa.OracleXAException)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:408)
at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:398)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:277)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:484)
at org.jboss.ejb.Container.invoke(Container.java:720)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
Caused by: oracle.jdbc.xa.OracleXAException
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1159)
at oracle.jdbc.xa.client.OracleXAResource.end(OracleXAResource.java:471)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.end(XAManagedConnection.java:155)
at org.jboss.tm.TransactionImpl.endResource(TransactionImpl.java:1193)
at org.jboss.tm.TransactionImpl.endResources(TransactionImpl.java:1266)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:350)
... 26 more
And datasource descriptor for oracle-xa:
<xa-datasource>
<jndi-name>oracle1</jndi-name>
<track-connection-by-tx>true</track-connection-by-tx>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
<xa-datasource-property name="URL">jdbc:oracle:thin:@titan:1521:repos1</xa-datasource-property>
<xa-datasource-property name="User">xxxx</xa-datasource-property>
<xa-datasource-property name="Password">xxxx</xa-datasource-property>
<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
<!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
<!-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
</xa-datasource>
<depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager
All I'm doing to throw this exception is a FindByPrimaryKey. A method gets called to check the record exists and returns fine, as does FindByPrimaryKey. The container, I'm guessing, then tries a commit at some point after the connection gets closed and fails.
This is all the method does that connects to the db:
public boolean selectByPrimKey(String id) throws SQLException{
Connection testCon;
try{
InitialContext ic = new InitialContext();
DataSource ora = (DataSource) ic.lookup("java:/oracle1");
testCon = ora.getConnection();
}catch(Exception e){e.printStackTrace(); throw new EJBException("selectByPrimKey: " + e.getMessage());}
boolean result;
String selectStatement =
"select id " +
"from sys.student where id = ? ";
PreparedStatement prepStmt =
testCon.prepareStatement(selectStatement);
prepStmt.setString(1, id);
ResultSet rs = prepStmt.executeQuery();
result = rs.next();
prepStmt.close();
testCon.close();
return result;
} -
20. Re: unable to commit with JBoss 3.2.2
adrian.brock Nov 2, 2003 11:18 AM (in response to juergenschwarz)Start your own thread!
Not the same problem at all.
Regards,
Adrian