XA Transactions - XADataSource
Hi,
Im trying to work out whats going on in WLS when I want a container managed XA
transaction.
I want an XA transaction between an XA DataSource and an XA JMS queue connection.
I was surprised to find that the DataSource bound in JNDI (with global tx turned
on) is not an XADataSource....
Am I missing something?
Thanks.
Nick
Hi Nick!
JMS internally does XA work for you. That is why you do not need XADataSource in that
case.
Mitesh
Nick wrote:
Hi,
Im trying to work out whats going on in WLS when I want a container managed XA
transaction.
I want an XA transaction between an XA DataSource and an XA JMS queue connection.
I was surprised to find that the DataSource bound in JNDI (with global tx turned
on) is not an XADataSource....
Am I missing something?
Thanks.
Nick
Similar Messages
-
Transaction propagation in DAO!
Hi Guys,
DAO pattern suggests that connections are obtained in DAOs itself. This means that if I am calling three DAOs from a session facade, there will be three different connections while dealing with database single transaction. Is this understanding correct?
The problem I am facing is - I am unable to make these three calls as one transaction. (Which is a result of three connections involved in the tx).
If I create a connection in session bean and then send it as parameter while calling these three DAOs, it works fine as a single tx. But I think it defeats the purpose of DAO as obtaining the connection should be the responsibility of DAO, not the session bean.
I am sure I am doing something fundamentally wrong. Can someone guide me here please?Guy,
Thanks for the reply. I understand the bit that I must use session bean transaction as "tx_required". Can you please throw some more light on XADataSource. Are you saying that whenever there are multiple connections involved in the transaction, XADataSource should be used? If this is the case then XADataSource should be used generally all the time while dealing with DAOs because there are usually more than one DAOs in a transaction.
I was reading "J2EE design patterns" book by Deepak Alur et al and it doesn't mention XADataSource while talking about DAO design pattern, though it talks about obtaining the connection in the DAO itself. Am bit confused!
Thanks again for your input. -
XA transaction using weblogic.jdbc.oci.xa.XADataSource
Hi everyone, I am trying to execute XA transaction using the driver XA compatible
driver
weblogic.jdbc.oci.xa.XADataSource. I have added c:\bea7.0SP4
\weblogic700\server\bin\ntvinv\oci817_8\weblogicoci38.dll in the PATH in my
weblogic managed server startup script.
When I start managed server, I get the error saying that weblogicoci38.dll
is not in java.library.path. I checked the server log file and in that
it clearly shows that java.library.path contains this file. Please suggest
me what to do.
I have weblogic 7.0 with SP4 and databse is oracle 8i.
thanks,
jyothi
####<Mar 1, 2004 9:52:36 AM EST> <Error> <JDBC> <temp1> <server1> <main> <kernel
identity> <> <001060> <Cannot startup connection pool "ConnPool1" java.sql.SQLException:
System.loadLibrary(weblogicoci38) threw java.lang.UnsatisfiedLinkError: no weblogicoci38
in java.library.path>
####<Mar 1, 2004 9:52:49 AM EST> <Info> <Management> <temp1> <server1> <main>
<kernel identity> <> <141187> <Java system properties are defined as follows:
awt.toolkit = sun.awt.windows.WToolkit
bea.home = c:\bea7.0SP4
file.encoding = Cp1252
file.encoding.pkg = sun.io
file.separator = \
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.awt.printerjob = sun.awt.windows.WPrinterJob
java.class.path = c:\bea7.0SP4\jdk131_08\lib\tools.jar;c:\bea7.0SP4\weblogic700\server\lib\weblogic_sp.jar;c:\bea7.0SP4\weblogic700\server\lib\weblogic.jar;c:\bea7.0SP4\weblogic700\server\bin\ntvinv\oci817_8\weblogicoci38.dll;C:\bea7.0SP4\user_projects\jytDmnCluster\lib\parser.jar.jar;C:\bea7.0SP4\user_projects\jytDmnCluster\lib\xml4j_1_1_16.jar;C:\bea7.0SP4\user_projects\jytDmnCluster\p6spy.jar
java.class.version = 47.0
java.ext.dirs = c:\bea7.0SP4\jdk131_08\jre\lib\ext
java.home = c:\bea7.0SP4\jdk131_08\jre
java.io.tmpdir = C:\DOCUME~1\jshanbag\LOCALS~1\Temp\
java.library.path = c:\bea7.0SP4\jdk131_08\bin;.;C:\WINNT\System32;C:\WINNT;.;c:\bea7.0SP4\weblogic700\server\bin;c:\bea7.0SP4\jdk131_08\bin;c:\bea7.0SP4\weblogic700\server\bin\ntvinv\oci817_8\weblogicoci38.dll;\jpda\bin;C:\Oracle\Ora81\bin;C:\Program
Files\Oracle\jre\1.1.7\bin;C:\PROGRA~1\PVCS\VM\win32\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32\WBEM;c:\;c:\vslick\winjyothip wrote:
Hi everyone, I am trying to execute XA transaction using the driver XA compatible
driver
weblogic.jdbc.oci.xa.XADataSource. I have added c:\bea7.0SP4
\weblogic700\server\bin\ntvinv\oci817_8\weblogicoci38.dll in the PATH in my
weblogic managed server startup script.
When I start managed server, I get the error saying that weblogicoci38.dll
is not in java.library.path. I checked the server log file and in that
it clearly shows that java.library.path contains this file. Please suggest
me what to do.Hi. This error message can be confusing for some OSes. If the process tries to
load a method from XYZ.DLL, and finds the DLL, but in order to load that method,
it finds it needs to also load ABC.DLL (such as the Oracle OCI DLL or the OS C libraries)
and doesn't find that lower-level DLL, the user can get a message mentioning only the
first (present) DLL. Please print out your full java.library.path. Does it correctly
list all the basing OS C libraries, and the Oracle Clint library path?
thanks,
Joe
>
I have weblogic 7.0 with SP4 and databse is oracle 8i.
thanks,
jyothi
####<Mar 1, 2004 9:52:36 AM EST> <Error> <JDBC> <temp1> <server1> <main> <kernel
identity> <> <001060> <Cannot startup connection pool "ConnPool1" java.sql.SQLException:
System.loadLibrary(weblogicoci38) threw java.lang.UnsatisfiedLinkError: no weblogicoci38
in java.library.path>
####<Mar 1, 2004 9:52:49 AM EST> <Info> <Management> <temp1> <server1> <main>
<kernel identity> <> <141187> <Java system properties are defined as follows:
awt.toolkit = sun.awt.windows.WToolkit
bea.home = c:\bea7.0SP4
file.encoding = Cp1252
file.encoding.pkg = sun.io
file.separator = \
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.awt.printerjob = sun.awt.windows.WPrinterJob
java.class.path = c:\bea7.0SP4\jdk131_08\lib\tools.jar;c:\bea7.0SP4\weblogic700\server\lib\weblogic_sp.jar;c:\bea7.0SP4\weblogic700\server\lib\weblogic.jar;c:\bea7.0SP4\weblogic700\server\bin\ntvinv\oci817_8\weblogicoci38.dll;C:\bea7.0SP4\user_projects\jytDmnCluster\lib\parser.jar.jar;C:\bea7.0SP4\user_projects\jytDmnCluster\lib\xml4j_1_1_16.jar;C:\bea7.0SP4\user_projects\jytDmnCluster\p6spy.jar
java.class.version = 47.0
java.ext.dirs = c:\bea7.0SP4\jdk131_08\jre\lib\ext
java.home = c:\bea7.0SP4\jdk131_08\jre
java.io.tmpdir = C:\DOCUME~1\jshanbag\LOCALS~1\Temp\
java.library.path = c:\bea7.0SP4\jdk131_08\bin;.;C:\WINNT\System32;C:\WINNT;.;c:\bea7.0SP4\weblogic700\server\bin;c:\bea7.0SP4\jdk131_08\bin;c:\bea7.0SP4\weblogic700\server\bin\ntvinv\oci817_8\weblogicoci38.dll;\jpda\bin;C:\Oracle\Ora81\bin;C:\Program
Files\Oracle\jre\1.1.7\bin;C:\PROGRA~1\PVCS\VM\win32\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32\WBEM;c:\;c:\vslick\win -
Can I include MQSeires JMS XADataSource and Oracle JDBC XADataSource in one transaction?
When I try to use a XADataSource (using Oracle 8.1.6 XA JDBC driver) to update
a table in onMessage() of a MDB (Message Driven Bean) using container managed
transaction, an exception occured like this:
java.sql.SQLException: ORA-06550: ? 1 ?, ? 14 ???: PLS-00201: ??? 'JAVA_XA.XA_START'
????? ORA-06550: ? 1 ?, ? 8 ???: PL/SQL: Statement ignored
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114) at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:542) at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1311)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:738 ) at
oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.ja va:1313)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.jav a:1232)
at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(OracleStatement .java:1353)
at oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java:176 0) at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme nt.java:1805)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar edStatement.java:322)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat ement.java:366)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:10 2) at
weblogic.transaction.internal.ServerResourceInfo.start(ServerResource Info.java:994)
at weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResour ceInfo.java:947)
at weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourc eInfo.java:206)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(Se rverTransactionImpl.java:316)
at weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java:6 51) at
weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator. java:444)
at weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator. java:379)
at weblogic.common.internal.ResourceAllocator.reserveWaitSecs(ResourceAl locator.java:369)
at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.j ava:167)
at weblogic.jdbc.common.internal.ConnectionPool.reserveWaitSecs(Connecti onPool.java:121)
at weblogic.jdbc.jta.DataSource.getXAConnectionFromPool(DataSource.java: 861)
at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:7 43) at
weblogic.jdbc.jta.Connection.getXAConn(Connection.java:130) at weblogic.jdbc.jta.Connection.createStatement(Connection.java:201)
at weblogic.jdbc.rmi.internal.ConnectionImpl.createStatement(ConnectionI mpl.java:71)
at weblogic.jdbc.rmi.SerialConnection.createStatement(SerialConnection.j ava:42)
at MDB.onMessage(MDB.java:46) at weblogic.ejb20.internal.MDListener.execute(MDListener.java:221)
at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:175) at com.ibm.mq.jms.MQQueueReceiver.receiveAsync(MQQueueReceiver.java:640)
at com.ibm.mq.jms.SessionAsyncHelper.run(SessionAsyncHelper.java:355) java.sql.SQLException:
ORA-06550: ? 1 ?, ? 14 ???: PLS-00201: ??? 'JAVA_XA.XA_START' ????? ORA-06550:
? 1 ?, ? 8 ???: PL/SQL: Statement ignored
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114) at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:542) at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1311)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:738 ) at
oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.ja va:1313)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.jav a:1232)
at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(OracleStatement .java:1353)
at oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java:176 0) at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme nt.java:1805)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar edStatement.java:322)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat ement.java:366)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:10 2) at
weblogic.jdbc.jta.DataSource.start(DataSource.java:324) at weblogic.transaction.internal.ServerResourceInfo.start(ServerResource
Info.java:994) at weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResour
ceInfo.java:947) at weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourc
eInfo.java:206) at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(Se
rverTransactionImpl.java:316) at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:817)
at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:7 88) at
weblogic.jdbc.jta.Connection.getXAConn(Connection.java:130) at weblogic.jdbc.jta.Connection.createStatement(Connection.java:201)
at weblogic.jdbc.rmi.internal.ConnectionImpl.createStatement(ConnectionI mpl.java:71)
at weblogic.jdbc.rmi.SerialConnection.createStatement(SerialConnection.j ava:42)
at MDB.onMessage(MDB.java:46) at weblogic.ejb20.internal.MDListener.execute(MDListener.java:221)
at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:175) at com.ibm.mq.jms.MQQueueReceiver.receiveAsync(MQQueueReceiver.java:640)
at com.ibm.mq.jms.SessionAsyncHelper.run(SessionAsyncHelper.java:355) java.sql.SQLException:
XA error: XAER_RMERR : A resource manager error has occur ed in the transaction
branch start() failed on resource 'jtaXAPool' null at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:822)
at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:7 88) at
weblogic.jdbc.jta.Connection.getXAConn(Connection.java:130) at weblogic.jdbc.jta.Connection.createStatement(Connection.java:201)
at weblogic.jdbc.rmi.internal.ConnectionImpl.createStatement(ConnectionI mpl.java:71)
at weblogic.jdbc.rmi.SerialConnection.createStatement(SerialConnection.j ava:42)
at MDB.onMessage(MDB.java:46) at weblogic.ejb20.internal.MDListener.execute(MDListener.java:221)
at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:175) at com.ibm.mq.jms.MQQueueReceiver.receiveAsync(MQQueueReceiver.java:640)
at com.ibm.mq.jms.SessionAsyncHelper.run(SessionAsyncHelper.java:355)
Does that mean WLS 6.0 SP1 can not include JMS XADataSource and JDBC XADataSource
in one distributed transaction managed by container?
It should work. Check out the documentation on our developer center for
more information. Developer.BEA.com
Michael Girdley
BEA Systems
Learning WebLogic? http://learnweblogic.com
"Sam Ni" <[email protected]> wrote in message
news:[email protected]...
>
> When I try to use a XADataSource (using Oracle 8.1.6 XA JDBC driver) to
update
> a table in onMessage() of a MDB (Message Driven Bean) using container
managed
> transaction, an exception occured like this:
>
> java.sql.SQLException: ORA-06550: ? 1 ?, ? 14 ???: PLS-00201: ???
'JAVA_XA.XA_START'
> ????? ORA-06550: ? 1 ?, ? 8 ???: PL/SQL: Statement ignored
>
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114) at
oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
> at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:542) at
oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1311)
> at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:738 )
at
> oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.ja
va:1313)
> at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.jav
a:1232)
> at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(OracleStatement
.java:1353)
> at oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java:176
0) at
> oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1805)
> at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
edStatement.java:322)
> at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat
ement.java:366)
> at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:10
2) at
> weblogic.transaction.internal.ServerResourceInfo.start(ServerResource
Info.java:994)
> at weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResour
ceInfo.java:947)
> at weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourc
eInfo.java:206)
> at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(Se
rverTransactionImpl.java:316)
> at weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java:6
51) at
> weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.
java:444)
> at weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.
java:379)
> at weblogic.common.internal.ResourceAllocator.reserveWaitSecs(ResourceAl
locator.java:369)
> at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.j
ava:167)
> at weblogic.jdbc.common.internal.ConnectionPool.reserveWaitSecs(Connecti
onPool.java:121)
> at weblogic.jdbc.jta.DataSource.getXAConnectionFromPool(DataSource.java:
861)
> at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:7
43) at
> weblogic.jdbc.jta.Connection.getXAConn(Connection.java:130) at
weblogic.jdbc.jta.Connection.createStatement(Connection.java:201)
> at weblogic.jdbc.rmi.internal.ConnectionImpl.createStatement(ConnectionI
mpl.java:71)
> at weblogic.jdbc.rmi.SerialConnection.createStatement(SerialConnection.j
ava:42)
> at MDB.onMessage(MDB.java:46) at
weblogic.ejb20.internal.MDListener.execute(MDListener.java:221)
> at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:175) at
com.ibm.mq.jms.MQQueueReceiver.receiveAsync(MQQueueReceiver.java:640)
>
>
> at com.ibm.mq.jms.SessionAsyncHelper.run(SessionAsyncHelper.java:355)
java.sql.SQLException:
> ORA-06550: ? 1 ?, ? 14 ???: PLS-00201: ??? 'JAVA_XA.XA_START' ?????
ORA-06550:
> ? 1 ?, ? 8 ???: PL/SQL: Statement ignored
>
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114) at
oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
> at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:542) at
oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1311)
> at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:738 )
at
> oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.ja
va:1313)
> at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.jav
a:1232)
> at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(OracleStatement
.java:1353)
> at oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java:176
0) at
> oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1805)
> at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
edStatement.java:322)
> at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat
ement.java:366)
> at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:10
2) at
> weblogic.jdbc.jta.DataSource.start(DataSource.java:324) at
weblogic.transaction.internal.ServerResourceInfo.start(ServerResource
> Info.java:994) at
weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResour
> ceInfo.java:947) at
weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourc
> eInfo.java:206) at
weblogic.transaction.internal.ServerTransactionImpl.enlistResource(Se
> rverTransactionImpl.java:316) at
weblogic.jdbc.jta.DataSource.enlist(DataSource.java:817)
> at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:7
88) at
> weblogic.jdbc.jta.Connection.getXAConn(Connection.java:130) at
weblogic.jdbc.jta.Connection.createStatement(Connection.java:201)
> at weblogic.jdbc.rmi.internal.ConnectionImpl.createStatement(ConnectionI
mpl.java:71)
> at weblogic.jdbc.rmi.SerialConnection.createStatement(SerialConnection.j
ava:42)
> at MDB.onMessage(MDB.java:46) at
weblogic.ejb20.internal.MDListener.execute(MDListener.java:221)
> at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:175) at
com.ibm.mq.jms.MQQueueReceiver.receiveAsync(MQQueueReceiver.java:640)
>
>
> at com.ibm.mq.jms.SessionAsyncHelper.run(SessionAsyncHelper.java:355)
java.sql.SQLException:
> XA error: XAER_RMERR : A resource manager error has occur ed in the
transaction
> branch start() failed on resource 'jtaXAPool' null at
weblogic.jdbc.jta.DataSource.enlist(DataSource.java:822)
> at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:7
88) at
> weblogic.jdbc.jta.Connection.getXAConn(Connection.java:130) at
weblogic.jdbc.jta.Connection.createStatement(Connection.java:201)
> at weblogic.jdbc.rmi.internal.ConnectionImpl.createStatement(ConnectionI
mpl.java:71)
> at weblogic.jdbc.rmi.SerialConnection.createStatement(SerialConnection.j
ava:42)
> at MDB.onMessage(MDB.java:46) at
weblogic.ejb20.internal.MDListener.execute(MDListener.java:221)
> at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:175) at
com.ibm.mq.jms.MQQueueReceiver.receiveAsync(MQQueueReceiver.java:640)
>
>
> at com.ibm.mq.jms.SessionAsyncHelper.run(SessionAsyncHelper.java:355)
>
>
> Does that mean WLS 6.0 SP1 can not include JMS XADataSource and JDBC
XADataSource
> in one distributed transaction managed by container?
>
>
-
Oracle 9 and XA transaction recovery
Just thought I would pass on a bit of advice if you are attempting to enable XA transaction recovery from either Application Server 7.0 or 8.1 with Oracle version 9.2.0.6 and possibly above.
In 9.2.0.6 Oracle changed the way they responded to XA recovery queries from transaction managers and so to now allow a list of XAID's to be returned without an exception being raised you will need to have the following privileges on the Application Server Oracle user attempting to do the recovery:
Select on DBA_PENDING_TRANSACTIONS, PENDING_TRANS$, DBA_2PC_PENDING and DBA_2PC_NEIGHBORS
and the new one execute on DBMS_SYSTEM
Also I discovered that although a db ping is possible in Application server 8.1 with lower case properties on the user, password and url (JDBC Pool properties) in order to get XA recovery to work for some reason these had to be changed to be case sensitive. See below:
Not working:
<jdbc-connection-pool connection-validation-method="table"
datasource-classname="oracle.jdbc.xa.client.OracleXADataSou
rce" fail-all-connections="false" idle-timeout-in-seconds="300"
is-connection-validation-required="true" is-isolation-leve
l-guaranteed="false" max-pool-size="32"
max-wait-time-in-millis="60000" name="OraclePool"
pool-resize-quantity="2" res-typ
e="javax.sql.XADataSource" steady-pool-size="8"
validation-table-name="DUAL">
<description>Oracle Pool</description>
<property name="user" value="sunone"/>
<property name="url" value="jdbc:oracle:oci:@SS"/>
<property name="password" value="sunone"/>
</jdbc-connection-pool>
Working!!
<jdbc-connection-pool connection-validation-method="table"
datasource-classname="oracle.jdbc.xa.client.OracleXADataSou
rce" fail-all-connections="false" idle-timeout-in-seconds="300"
is-connection-validation-required="true" is-isolation-leve
l-guaranteed="false" max-pool-size="32"
max-wait-time-in-millis="60000" name="OraclePool"
pool-resize-quantity="2" res-typ
e="javax.sql.XADataSource" steady-pool-size="8"
validation-table-name="DUAL">
<description>Oracle Pool</description>
<property name="User" value="sunone"/>
<property name="URL" value="jdbc:oracle:oci:@SS"/>
<property name="Password" value="sunone"/>
</jdbc-connection-pool>
Just thought I would share that with you!I am able to connect and message to Oracle AQ using an XA Datasource using the getVendorConnection method on the Weblogic connection wrapper (WLConnection).
This, however, seems to be memory leaking quite badly. I've followed the Weblogic documentation (which says that you should not call close() on the Vendor connection).
I've also tried closing the vendorConnection object and nulling out the reference that the WLConnection holds. This slows the leak, but it appears that the WLConnections are never being released.
Has anyone else had any success doing this?
Dom. -
Hello,
I was wondering if anyone else has experienced this problem and/or can suggest a solution...btw, I'm running this on JRun4.
I have a JMS queue that uses a database for the queue. The onMessage method for my MDB is part of a container managed transaction. My onMessage method simply inserts the message into an audit table. I then purposely change the name of the audit table so that my MDB will throw a SQLException.
If I send a single message, a SQL exception is thrown and caught and I roll back the transaction via MessageDrivenContext.setRollbackOnly(). The stdout logs show that after the exception the transaction is rolled back and the message is resent. This sequence occurs repeatedly until I fix the column name and then the message is consumed and inserted in my audit table. This works as I expect.
If I were to send 2 (or more) messages, the same SQL exception occurs for each message and the transaction is rolled back and the message(s) are resent. However, once I fix the table error, I find that those 2 messages were repeatedly consumed and inserted into the audit table (e.g. there were 50+ inserts). In the stdout logs it appears once the database problem is corrected each transaction that was rolled back now ends up commiting leading to repeat consumptions.
Has anyone encountered this? I'm a bit confused as to why, since the rollbacks, resends, and commits appear to work fine when there is only a single message.
Any suggestions? Thanks.This is only a guess, but I'd say that the implementation isn't using two-phase commit aware resources (XAResources) to coordinate modifications to the backend database table. If you're only using a single resource (message in your case) then it's fine to use raw JDBC and turn auto-commit off; the application or container can then use the JDBC driver commit or rollback operations to make the change to the table happen (or not). If you're doing multiple updates through the same JDBC driver within the same global transaction then this still works.
I wonder if the implementation is somehow adding each message through a separate JDBC instance (even though to the same back end DM) and committing each prior to doing work on the next message. This commit may not be explicit. You may not even know it is going on: for example, if the back end db is Oracle, if you do a close on a JDBC connection which is running in a transaction then it will implicitly commit the transaction at that point.
For instance:
receive message
get JDBC connection
add message to table
close JDBC connection (may be explicit or may be implicit via the container)
<-- commit happens here in some cases
receive message
get JDBC connection
add message to table
What the implementation really should use is XADataSources and XAConnections to get XAResources that coordinate updates to the database. Or, make sure the same JDBC connection is used within the same transaction. This is more difficult to coordinate because of close. -
MDB Distributed transaction and stored procedure rollback
Hi All,
I am developing an asynchronous application using MDB. My application flow is as follows:
1. From MDB onMessage i am calling another method MEthodA that
a. calls a simple pojo1 where I am getting a Connection on XA enable datasource1 and executing Stored Procedure1 of DatabaseSchema1. In Stored Procedure1 I have some inner savpoints and rollback. No commit is inside Stored Procedure1 .
b. In that pojo withput commiting m closing the connection and coming back in MethodA.
c. Again from MethodA m calling an different pojo2 where I am getting a new Connection on XA enable datasource2 and executing Stored Procedure2 of DatabaseSchema1.In this pojo also without commiting m closing the connection and coming back in MethodA. In Stored Procedure2 I have some inner savpoints and rollback. No commit is inside Stored Procedure2 .
d. Again from MethodA m calling pojo1 where I am getting a new Connection on XA enable datasource1 and executing a diffrent function of Stored Procedure1 of DatabaseSchema1.
Now problem is:
I have written some Savepoint and rollback inside Stored Procedure1 and inside Stored Procedure2. But these rollback is working only in inside Stored Procedure1 not in inside Stored Procedure2 in each case.
In ejb-jar.xml transaction attributes is Required for all methods and transaction type is Container.
Backend is Oracle 10g and init.xa has already been run on that.
I have tested this on Oc4J and Websphere 6.0.
I am using XaDatasource.
Will be very obliged if any one can give a single hint of the problem as soon as possible.
Thanks a lotHi Kent;
You have a few choices (AFAIK) with ASE...
1) AutoCommit = TRUE
- must be before connect to your DB
2) End your PB transaction first. For example
String ls_end = "END TRANSACTION"
String ls_begin = "BEGIN TRANSACTION"
EXECUTE IMMEDIATE ls_end using SQLCA;
<call your SP>
EXECUTE IMMEDIATE ls_begin using SQLCA;
3) use a 2nd Transaction Object for the SP where its AutoCommit = TRUE
- or -
4) In your SP ...
Commit Transaction
begin transaction
insert into mytab (pub_id) values ("9999")
commit transaction -
Combining single transaction between session bean & application client
Hi All,
The following transaction exception was encountered when trying to combine a EmployeeSessionBean.create(Employee) method in an application client:
Application Client output
SEVERE: null
javax.transaction.SystemException: org.omg.CORBA.UNKNOWN: ----------BEGIN server-side stack trace----------
org.omg.CORBA.UNKNOWN: WARNING: IOP00010002: Unknown user exception thrown by the server - exception: org.eclipse.persistence.exceptions.DatabaseException; message:
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: java.lang.IllegalStateException: cannot add non-XA Resource to global JTS transaction.
Error Code: 0
Call: INSERT INTO EmployeeDB.Project (ID, NAME) VALUES (?, ?)
bind => [2 parameters bound]
Query: InsertObjectQuery(domain.Project@19d2d53) vmcid: OMG minor code: 2 completed: Maybe
at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:117)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:126)
----------END server-side stack trace---------- vmcid: OMG minor code: 2 completed: Maybe
at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:332)
at com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate.commitDistributedTransaction(JavaEETransactionManagerJTSDelegate.java:184)
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:873)
at com.sun.enterprise.transaction.UserTransactionImpl.commit(UserTransactionImpl.java:208)
at applicationClient(*applicationClient.java:229*)
GF 3.1 Server log
WARNING: A system exception occurred during an invocation on EJB EmployeeSessionBean method public void ejb.EmployeeSessionBean.create(Employee) javax.ejb.EJBException
Caused by: javax.persistence.TransactionRequiredException
at ejb.EmployeeSessionBean.create(*EmployeeSessionBean.java:27*)
SEVERE: RAR5027:Unexpected exception in resource pooling
java.lang.IllegalStateException: cannot add non-XA Resource to global JTS transaction.
WARNING: RAR7132: Unable to enlist the resource in transaction. Returned resource to pool. Pool name: [ mysqlPool ]
WARNING: RAR5117 : Failed to obtain/create connection from connection pool [ mysqlPool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException: java.lang.IllegalStateException: cannot add non-XA Resource to global JTS transaction.
WARNING: RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: java.lang.IllegalStateException: cannot add non-XA Resource to global JTS transaction.]
WARNING: Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: java.lang.IllegalStateException: cannot add non-XA Resource to global JTS transaction.
Below is the code snippet of EmployeeSessionBean & client.applicationClient:
@Stateless
//@TransactionManagement(TransactionManagementType.BEAN)
public class EmployeeSessionBean implements EmployeeService {
@PersistenceContext(unitName="EmployeeDB-PU")
private EntityManager manager;
public void create(Employee employee) {
manager.persist(employee); // line 27
import javax.transaction.UserTransaction;
public class applicationClient {
@Resource UserTransaction tx;
@EJB private static EmployeeService bean;
try {
tx.begin();
Employee employee = new Employee()
bean.create(employee);
} finally {
try {
tx.commit(); // line 229
}How to relinguish transaction on EmployeeSessionBean so that all transaction could take place in applicationClient side only?
I am trying to apply examples in Pro JPA 2 to a Java EE 6 ManyToMany application.
Your assistance would be much appreciated.
Thanks,
JackHi r035198x,
Thank you for some solid advice and would rather JPA take care of all the special cases such as keeping the records unique.
Below are the changes made as suggested in ( 1 ), ( 2 ), ( 3 ):
@Entity
@IdClass(EmployeePK.class)
@Table(name="EMPLOYEE", catalog="EmployeeDB", schema="")
public class Employee implements Serializable {
@Id
@Column(name="FIRSTNAME")
private String firstName;
@Id
@Column(name="SURNAME")
private String surName;
@Id
@Column(name="DOB")
@Temporal(TemporalType.DATE)
private Date dob;
@ManyToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, fetch=FetchType.EAGER)
@JoinTable(name="EMPLOYEE_PROJECT", catalog="EmployeeDB", schema="",
joinColumns={@JoinColumn(name="FIRSTNAME_ID", referencedColumnName="FIRSTNAME"),
@JoinColumn(name="SURNAME_ID", referencedColumnName="SURNAME"),
@JoinColumn(name="DOB", referencedColumnName="DOB")},
inverseJoinColumns={@JoinColumn(name="PROJECT_ID")})
private Set<Project> projects = new HashSet<Project>();
@Entity
@Table(name="PROJECT", catalog="EmployeeDB", schema="")
public class Project implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="ID")
private int id;
@ManyToMany(mappedBy="projects", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, fetch=FetchType.EAGER)
@JoinTable(name="EMPLOYEE_PROJECT", catalog="EmployeeDB", schema="",
joinColumns={@JoinColumn(name="PROJECT_ID", referencedColumnName="PROJECT_ID")},
inverseJoinColumns={@JoinColumn(name="FIRSTNAME_ID", referencedColumnName="FIRSTNAME"),
@JoinColumn(name="SURNAME_ID", referencedColumnName="SURNAME"),
@JoinColumn(name="DOB_ID", referencedColumnName="DOB")})
private Set<Employee> employees = new HashSet<Employee>();
@Stateless
public class EmployeeSessionBean implements EmployeeService {
@PersistenceContext(unitName="EmployeeDB-PU") private EntityManager manager;
public void create(Employee employee)
manager.persist(employee);
public class applicationClient {
@EJB
private static EmployeeService bean;
public static void main(String[] args) {
Employee employee = new Employee()
bean.create(employee); // line 209
} I have diverged slightly from using simple primary key (EMPLOYEE_ID) to composite key class (FIRSTNAME, SURNAME, DOB) to resemble the actual application.
Also gone back to using non - XADatasources since I am depending on JTA to do all the hardwork on the server side.
Unfortunately, we have hit a snag once again with the following exception still:
Application Client Output
java.lang.reflect.InvocationTargetException
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:597)
at org.glassfish.appclient.client.acc.AppClientContainer.launch(AppClientContainer.java:432)
at org.glassfish.appclient.client.AppClientFacade.launch(AppClientFacade.java:182)
at org.glassfish.appclient.client.AppClientGroupFacade.main(AppClientGroupFacade.java:65)
Caused by: javax.ejb.EJBException: java.rmi.MarshalException: CORBA MARSHAL 1330446347 Maybe; nested exception is:
org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack trace----------
org.omg.CORBA.MARSHAL: WARNING: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream vmcid: OMG minor code: 11 completed: Maybe
Caused by: java.io.StreamCorruptedException: WARNING: ORBIO00013: Stream corrupted
----------END server-side stack trace---------- vmcid: OMG minor code: 11 completed: Maybe
at ejb._EmployeeService_Wrapper.create(ejb/_EmployeeService_Wrapper.java)
at applicationClient(applicationClient.java:209)
GF 3.1 Server log
WARNING: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream
org.omg.CORBA.MARSHAL: WARNING: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream vmcid: OMG minor code: 11 completed: Maybe
Caused by: java.lang.NullPointerException
WARNING: ORBIO00013: Stream corrupted
java.io.StreamCorruptedException: WARNING: ORBIO00013: Stream corrupted
Your valuable input would be very appreciated.
Thanks,
Jack -
How to use Transaction in Stateless SessionBean?
I want to use a transaction in a stateless sessionbean.Here is the code I am using:
public void createQuestion(QuestionModel questionModel,Collection outcomeList) throws Exception{
UserTransaction ut=getUserTransaction();
try{
QuestionHome qHome=EJBUtil.getQuestionHome();
QuestionOutcomeHome qoHome=EJBUtil.getQuestionOutcomeHome();
ut.begin();
QuestionRemote qr=qHome.create(questionModel.getName(),questionModel.getContent(),questionModel.getCreatorId());
Long id=qr.getQuestionModel().getId();
Iterator outcomes=outcomeList.iterator();
while(outcomes.hasNext()){
QuestionOutcomeModel qom=(QuestionOutcomeModel)outcomes.next();
QuestionOutcomeRemote qor=qoHome.create(id,qom.getValue(),qom.getFeedBack());
ut.commit();
}catch(Exception e){
ut.rollback();
throw new Exception(e);
private UserTransaction getUserTransaction() throws NamingException{
UserTransaction ut=null;
try{
InitialContext ic = new InitialContext();
ut = (UserTransaction) ic.lookup("UserTransaction");
} catch (NamingException ne) {
throw new EJBException(ne);
return ut;
And In the entity bean,I define a XADatasource:
private Connection getXADBConnection() throws SQLException {
Connection connection;
try {
InitialContext ic = new InitialContext();
DataSource ds = (DataSource)
ic.lookup("java:/MSSQLXaDS");
connection = ds.getConnection();
} catch (NamingException ne) {
throw new EJBException(ne);
} catch (SQLException se) {
throw new EJBException(se);
return connection;
When I run the code, it throws the following Exception:
java.lang.Exception: java.lang.reflect.UndeclaredThrowableException
at com.dynasty.testing.testcontent.control.TestContentSB.createQuestion(TestContentSB.java:239)
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.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)
at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
at org.jboss.ejb.Container.invoke(Container.java:712)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:382)
at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
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)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:138)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
at $Proxy1.createQuestion(Unknown Source)
at com.dynasty.testing.test.TestContentSBTestClient1.main(TestContentSBTestClient1.java:466)
Caused by: java.lang.reflect.UndeclaredThrowableException
at $Proxy196.create(Unknown Source)
at com.dynasty.testing.testcontent.control.TestContentSB.createQuestion(TestContentSB.java:229)
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.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)
at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
at org.jboss.ejb.Container.invoke(Container.java:712)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:382)
at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
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: javax.resource.ResourceException: associateConnection not supported
at org.jboss.resource.adapter.jdbc.BaseManagedConnection.associateConnection(BaseManagedConnection.java:91)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnect(BaseConnectionManager2.java:594)
at org.jboss.resource.connectionmanager.CachedConnectionManager.reconnect(CachedConnectionManager.java:344)
at org.jboss.resource.connectionmanager.CachedConnectionManager.pushMetaAwareObject(CachedConnectionManager.java:140)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:183)
at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:90)
at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:163)
at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:107)
at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:59)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:105)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
at org.jboss.ejb.Container.invoke(Container.java:730)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:198)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
... 28 more
What's wrong with my code?Can anyone hlep me?ThanksSusan,
I am replying because I think we are in the same class at Wake Tech (Saturday morning with Jeff Griemann), trying to get past the same problem. After many frustrating hours, I have the answer. Reinstall Tomcat in a directory with NO SPACES in the directory name. That it!
Dennis -
Two phase commit and bean managed transactions
To all the Transaction GURUS!
Hi guys (-and gals).
I've been doing J2EE for quite a while, but today was my first at
XA-Transactions and Bean Managed Transactions.
Why am I doing this?
====================
Well I have to be able to controll the transactionalbehaviour of my
bean
during runtime, since some bean calls would cause a transactional
overflow due to the stress they would cause to the system, whereas
smaller bean calls need to run in one transaction.
-> Therefore I need Bean Managed Transactions
Since the bean does a call on two Database Connections it has to use a
XA-Transaction.
-> Therefore I need XA-Transactions.
Abstract
========
- I just can't get a User TransAction into the right Status it stays
in 'STATUS_NO_TRANSACTION' all the time
- Therefore the SQL Commands can be comitted 'java.sql.SQLException:
Does not support SQL execution with no global transaction'
- Therefore I can't do a rollback 'java.lang.IllegalStateException:
Transaction does not exist'
- Therefore I wrote this mail.
I don't want to be a smart-"ass" writing such a detailed and indepth
mail. I just would like to show that I tried, and would like to have
some replies from you guys.
Below are my configurations, code and logfiles.
Thanx for taking your time and hope that the other people may learn
something as well.
cu
Stefan
Scenario
========
used Software
Bea Weblogic (WL) 6.0 SPx (not real sure which SP i have)
Oracle 8.1.6 using the API-Version 8
I configured the system as follows:
(ofcourse I 'xxx'ed out all of the confidential data, sorry guys;-))
excerpt from:
config.xml
<JDBCConnectionPool CapacityIncrement="5"
DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="2"
LoginDelaySeconds="1" MaxCapacity="5" Name="oraclePool"
Properties="user=xxx;password=xxx;dll=ocijdbc8;protocol=thin"
RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
TestTableName="languages" URL="jdbc:oracle:thin:@xxx:1521:xxx "/>
<!-- Since this is our Main Datasource I would not like to use a XA
Transaction due to performance Issues
and the TxDataSource:
-->
<JDBCTxDataSource EnableTwoPhaseCommit="true"
JNDIName="finstral.datasource.fbs" Name="finstral Content Datasource"
PoolName="oraclePool" Targets="fbsserver"/>
<!-- no comment required -I hope.
Next comes the "special" Pool
-->
<JDBCConnectionPool CapacityIncrement="5"
DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
Properties="user=xxx;password=xxx;server=xxx.xxx.xxx"
RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
TestTableName="Users" SupportsLocalTransaction="true"/>
<!-- Well since there can only be one none XARessourceManager involved
in a 2PC
(keyword: Two Phase Commit) I will have to use a XACapable Driver for
the other
Datasource. Due to all the bugs in the oracle.xxx driver. I'll be
using the jdriver for oci.
I activated 'SupportsLocalTransaction' hoping it would solve my
problem - without effect. I just left in there now, since it made
sense me. Not?
Again the TxDataSource:
-->
<JDBCTxDataSource EnableTwoPhaseCommit="true"
JNDIName="finstral.datasource.fbssecurity" Name="finstral Security
Datasource" PoolName="oracleSecurityPool" Targets="fbsserver"/>
<!-- The System starts right up and can locate the test tables and
everything. So I think all of this stuff is working here -->
ejb-jar.xml
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>TPCTestBean</ejb-name>
<home>de.sitewaerts.futuna.common.test.tpcbean.TPCHome</home>
<remote>de.sitewaerts.futuna.common.test.tpcbean.TPC</remote>
<ejb-class>de.sitewaerts.futuna.common.test.tpcbean.TPCBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor/>
</ejb-jar>
<!-- Originally I had the assembly-descriptor full of transaction
requirements. I thought since
the bean is handling all of the transaction stuff itself, it might get
confused by the 'container-transaction'
properties, and deleted them. Do I need them anyway?-->
weblogic-ejb-jar.xml
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>TPCTestBean</ejb-name>
<stateless-session-descriptor/>
<jndi-name>finstral/ejb/test_tpc</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
<!-- Nothing I have to explain here -->
BeanCode (from the implementingBeanClass:
'de.sitewaerts.futuna.common.test.tpcbean.TPCBean')
public void setupTables() throws RemoteException
UserTransaction tx = getTransaction();
//getTransaction calls: 'tx = sCtx.getUserTransaction()' and does
some errorhandling
log.info("Die Transaktion vor den Connections: "+tx.toString());
//Sorry bout the German. You should get the Message though.
log.info("Der Transaktionsstatus vor den Connections:
"+transactionStatus(tx));
Connection conSecurity = getConnection(DATASOURCE_SECURITY, tx);
//gets a Connection via a DataSourceName from the JNDI tree
Connection conContent = getConnection(DATASOURCE_CONTENT, tx);
log.info("Die frische Connection conSecurity: "+conSecurity);
log.info("Die frische Connection conContent: "+conContent);
tearDownTable(conSecurity);
//Does nothing special
tearDownTable(conContent);
log.info("Die Transaktion nach dem Teardown: "+tx.toString());
log.info("Der Transaktionsstatus nach dem Teardown:
"+transactionStatus(tx));
Statement stmt = null;
try
stmt = conSecurity.createStatement();
//Well its getting interesting now.....
log.info("Die Transaktion vor dem createtable: "+tx.toString());
log.info("Der Transaktionsstatus vor dem createtable:
"+transactionStatus(tx));
log.info("Die Connection conSecurity vor dem createtable:
"+conSecurity);
log.info("Die Connection conContent vor dem createtable:
"+conContent);
stmt.executeUpdate(CREATE_TABLE);
//above is the row 91 -> throws: 'java.sql.SQLException: Does
not support SQL execution with no global transaction'
stmt.close();
stmt = conContent.createStatement();
stmt.executeUpdate(CREATE_TABLE);
stmt.close();
commitTransaction(tx);
catch (SQLException sqle)
log.error("Konnte kein table init machen", sqle);
rollbackTransaction(tx);
//The Code for this method is below
throw new EJBException(sqle);
finally
closeConnection(conSecurity);
closeConnection(conContent);
protected void rollbackTransaction(UserTransaction tx)
log.info("Der Transaktionsstatus vor dem Rollback:
"+transactionStatus(tx));
log.info("Die Transaktion vor dem Rollback: "+tx.toString());
try
tx.rollback();
//above is row 200 -> throws: 'java.lang.IllegalStateException:
Transaction does not exist'
log.info("Der Transaktionsstatus nach dem Rollback:
"+transactionStatus(tx));
log.info("Die Transaktion nach dem Rollback: "+tx.toString());
catch (Exception e)
log.error("Konnte die Transaktion nicht backrollen.", e);
throw new EJBException(e);
Log Excerpt
===========
INFO setupTables() (66) - Die Transaktion vor den Connections:
[email protected]
INFO setupTables() (67) - Der Transaktionsstatus vor den Connections:
STATUS_NO_TRANSACTION
INFO setupTables() (72) - Die frische Connection conSecurity:
weblogic.jdbc.rmi.SerialConnection@7c6daa
INFO setupTables() (73) - Die frische Connection conContent:
weblogic.jdbc.rmi.SerialConnection@3b425
INFO setupTables() (78) - Die Transaktion nach dem Teardown:
[email protected]
INFO setupTables() (79) - Der Transaktionsstatus nach dem Teardown:
STATUS_NO_TRANSACTION
INFO setupTables() (86) - Die Transaktion vor dem createtable:
[email protected]
INFO setupTables() (87) - Der Transaktionsstatus vor dem createtable:
STATUS_NO_TRANSACTION
INFO setupTables() (88) - Die Connection conSecurity vor dem
createtable: weblogic.jdbc.rmi.SerialConnection@7c6daa
INFO setupTables() (89) - Die Connection conContent vor dem
createtable: weblogic.jdbc.rmi.SerialConnection@3b425
ERROR setupTables() (101) - Konnte kein table init machen
java.sql.SQLException: Does not support SQL execution with no global
transaction
at
weblogic.jdbc.oci.xa.XAConnection.beforeExecute(XAConnection.java:137)
at
weblogic.jdbc.oci.xa.Statement.executeUpdate(Statement.java:112)
at weblogic.jdbc.jta.Statement.executeUpdate(Statement.java:185)
at
weblogic.jdbc.rmi.internal.StatementImpl.executeUpdate(StatementImpl.jav
a:42)
at
weblogic.jdbc.rmi.SerialStatement.executeUpdate(SerialStatement.java:54)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.jav
a:91)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBean
Impl.java:130)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCBe
anEOImpl.java:64)
at
de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseCo
mmitUnitTest.java:51)
at
org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTes
tCase.java:297)
at
org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servle
tTestCaller.java:148)
at
org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCal
ler.java:199)
at
org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTes
tRedirector.java:149)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
java:213)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
etContext.java:1265)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
java:1631)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
INFO rollbackTransaction() (196) - Der Transaktionsstatus vor dem
Rollback: STATUS_NO_TRANSACTION
INFO rollbackTransaction() (197) - Die Transaktion vor dem Rollback:
[email protected]
ERROR rollbackTransaction() (206) - Konnte die Transaktion nicht
backrollen.
java.lang.IllegalStateException: Transaction does not exist
at
weblogic.transaction.internal.TransactionManagerImpl.rollback(Transactio
nManagerImpl.java:228)
at
weblogic.transaction.internal.TransactionManagerImpl.rollback(Transactio
nManagerImpl.java:222)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBean.rollbackTransaction(TPC
Bean.java:200)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.jav
a:102)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBean
Impl.java:130)
at
de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCBe
anEOImpl.java:64)
at
de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseCo
mmitUnitTest.java:51)
at
org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTes
tCase.java:297)
at
org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servle
tTestCaller.java:148)
at
org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCal
ler.java:199)
at
org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTes
tRedirector.java:149)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
java:213)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
etContext.java:1265)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
java:1631)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
CONCLUSION
==========
I'm going nuts.
I just don't get it.
The transaction is the same. I don't change the Connection. I start
the Transaction at the beginning before I do anything!
Please guys help me out.
Thx alot.
Stefan "it's three o'clock in the morning, my girlfriend left me, and
my only friend is that stupid linux pinguine" Siprell
Software-Development
<<<<<<<<<<<<<<<<<<<<<<<<<<<
<sitewaerts> GmbH
Hebelstraße 15
D-76131 Karlsruhe
Tel: +49 (721) 920 918 22
Fax: +49 (721) 920 918 29
http://www.sitewaerts.de
>>>>>>>>>>>>>>>>>>>>>>>>>>>
Hi Priscilla
(did you ever see the movie ? :-))
Well I moved away from the idea of using bean managed transaction. I'll
be using Container Managed Transactions. To modify the
transactionalbehaviour I'll write proxymethods which have certain
different containermanaged transaction properties, but which all call
the same private methods.
But it works! Here is my experience:
- I was doing a DDL statement: I was trying to create new Tables, which
is a definite "no-go"
- pay careful attention to:
http://edocs.bea.com/wls/docs60/jta/trxejb.html#1051405
and
http://edocs.bea.com/wls/docs60/jta/trxejb.html#1051741
and use these Settings for the Pool, don't ask me why, but it took me
hours to find it out by myself:
<JDBCConnectionPool CapacityIncrement="5"
DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
Properties="user=xxx; password=xxx; server=xxx.xxx.xxx"
RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
TestTableName="Users" SupportsLocalTransaction="true"/>
where as the server (shown as: xxx.xxx.xxx) is the TNS Name of the
Oracle Driver.
It works great.
Another thing you guys might want to do is write a simple StatelessSB
which does JDBC calls and two different database Connections.
Then write a UnitTest which calls this bean a couple hundred times (with
the same transaction). Have one test do clean writes, and another which
causes some SQL-Exception (too long Data Columns, or likewise).
Always count the entries and see if everything worked out. We're using
this SetupConstruction to test new combinations of AS(sorry Priscilla) /
Database / Db-Drivers to have a "standard test".
I know my two cents were uncalled for, but it might save you some
time.....
thanx for your help
Stefan
-----Ursprüngliche Nachricht-----
Von: Priscilla Fung [mailto:[email protected]]
Bereitgestellt: Donnerstag, 2. August 2001 21:42
Bereitgestellt in: transaction
Unterhaltung: Two phase commit and bean managed transactions
Betreff: Re: Two phase commit and bean managed transactions
Hi Stefan,
Looks like you have not actually begun a transaction by calling
UserTransaction.begin(),
so your setupTables method is really executing with no transaction
context.
Priscilla
Stefan Siprell <[email protected]> wrote:
>To all the Transaction GURUS!
>
>Hi guys (-and gals).
>I've been doing J2EE for quite a while, but today was my first at
>XA-Transactions and Bean Managed Transactions.
>
>Why am I doing this?
>====================
>Well I have to be able to controll the transactionalbehaviour of my
>bean
>during runtime, since some bean calls would cause a transactional
>overflow due to the stress they would cause to the system, whereas
>smaller bean calls need to run in one transaction.
>-> Therefore I need Bean Managed Transactions
>Since the bean does a call on two Database Connections it has to use
>a
>XA-Transaction.
>-> Therefore I need XA-Transactions.
>
>Abstract
>========
>- I just can't get a User TransAction into the right Status it stays
>in 'STATUS_NO_TRANSACTION' all the time
>- Therefore the SQL Commands can be comitted 'java.sql.SQLException:
>Does not support SQL execution with no global transaction'
>- Therefore I can't do a rollback 'java.lang.IllegalStateException:
>Transaction does not exist'
>- Therefore I wrote this mail.
>
>I don't want to be a smart-"ass" writing such a detailed and indepth
>mail. I just would like to show that I tried, and would like to have
>some replies from you guys.
>
>Below are my configurations, code and logfiles.
>
>Thanx for taking your time and hope that the other people may learn
>something as well.
>
>cu
>
>Stefan
>
>
>Scenario
>========
>
>used Software
>-------------
>Bea Weblogic (WL) 6.0 SPx (not real sure which SP i have)
>Oracle 8.1.6 using the API-Version 8
>
>
>I configured the system as follows:
>(ofcourse I 'xxx'ed out all of the confidential data, sorry guys;-))
>excerpt from:
>
>config.xml
>----------
><JDBCConnectionPool CapacityIncrement="5"
>DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="2"
>LoginDelaySeconds="1" MaxCapacity="5" Name="oraclePool"
>Properties="user=xxx;password=xxx;dll=ocijdbc8;protocol=thin"
>RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
>TestTableName="languages" URL="jdbc:oracle:thin:@xxx:1521:xxx "/>
>
><!-- Since this is our Main Datasource I would not like to use a XA
>Transaction due to performance Issues
>and the TxDataSource:
>-->
>
><JDBCTxDataSource EnableTwoPhaseCommit="true"
>JNDIName="finstral.datasource.fbs" Name="finstral Content Datasource"
>PoolName="oraclePool" Targets="fbsserver"/>
>
><!-- no comment required -I hope.
>Next comes the "special" Pool
>-->
>
><JDBCConnectionPool CapacityIncrement="5"
>DriverName="weblogic.jdbc.oci.xa.XADataSource" InitialCapacity="1"
>LoginDelaySeconds="1" MaxCapacity="2" Name="oracleSecurityPool"
>Properties="user=xxx;password=xxx;server=xxx.xxx.xxx"
>RefreshMinutes="5" Targets="fbsserver" TestConnectionsOnRelease="true"
>TestTableName="Users" SupportsLocalTransaction="true"/>
>
><!-- Well since there can only be one none XARessourceManager involved
>in a 2PC
>(keyword: Two Phase Commit) I will have to use a XACapable Driver for
>the other
>Datasource. Due to all the bugs in the oracle.xxx driver. I'll be
>using the jdriver for oci.
>I activated 'SupportsLocalTransaction' hoping it would solve my
>problem - without effect. I just left in there now, since it made
>sense me. Not?
>Again the TxDataSource:
>-->
>
><JDBCTxDataSource EnableTwoPhaseCommit="true"
>JNDIName="finstral.datasource.fbssecurity" Name="finstral Security
>Datasource" PoolName="oracleSecurityPool" Targets="fbsserver"/>
>
><!-- The System starts right up and can locate the test tables and
>everything. So I think all of this stuff is working here -->
>
>
>
>ejb-jar.xml
>-----------
><ejb-jar>
> <enterprise-beans>
> <session>
> <ejb-name>TPCTestBean</ejb-name>
>
><home>de.sitewaerts.futuna.common.test.tpcbean.TPCHome</home>
>
><remote>de.sitewaerts.futuna.common.test.tpcbean.TPC</remote>
>
><ejb-class>de.sitewaerts.futuna.common.test.tpcbean.TPCBean</ejb-class>
> <session-type>Stateless</session-type>
> <transaction-type>Bean</transaction-type>
> </session>
> </enterprise-beans>
> <assembly-descriptor/>
></ejb-jar>
>
><!-- Originally I had the assembly-descriptor full of transaction
>requirements. I thought since
>the bean is handling all of the transaction stuff itself, it might get
>confused by the 'container-transaction'
>properties, and deleted them. Do I need them anyway?-->
>
>weblogic-ejb-jar.xml
>--------------------
><weblogic-ejb-jar>
> <weblogic-enterprise-bean>
> <ejb-name>TPCTestBean</ejb-name>
> <stateless-session-descriptor/>
> <jndi-name>finstral/ejb/test_tpc</jndi-name>
> </weblogic-enterprise-bean>
></weblogic-ejb-jar>
>
><!-- Nothing I have to explain here -->
>
>BeanCode (from the implementingBeanClass:
>'de.sitewaerts.futuna.common.test.tpcbean.TPCBean')
>-----------------------------------------------------------------------
>---------------------
>
> public void setupTables() throws RemoteException
> {
> UserTransaction tx = getTransaction();
> //getTransaction calls: 'tx = sCtx.getUserTransaction()' and does
>some errorhandling
>
> log.info("Die Transaktion vor den Connections: "+tx.toString());
> //Sorry bout the German. You should get the Message though.
> log.info("Der Transaktionsstatus vor den Connections:
>"+transactionStatus(tx));
>
> Connection conSecurity = getConnection(DATASOURCE_SECURITY, tx);
> //gets a Connection via a DataSourceName from the JNDI tree
> Connection conContent = getConnection(DATASOURCE_CONTENT, tx);
>
> log.info("Die frische Connection conSecurity: "+conSecurity);
> log.info("Die frische Connection conContent: "+conContent);
>
> tearDownTable(conSecurity);
> //Does nothing special
> tearDownTable(conContent);
>
> log.info("Die Transaktion nach dem Teardown: "+tx.toString());
> log.info("Der Transaktionsstatus nach dem Teardown:
>"+transactionStatus(tx));
>
> Statement stmt = null;
> try
> {
> stmt = conSecurity.createStatement();
> //Well its getting interesting now.....
>
> log.info("Die Transaktion vor dem createtable: "+tx.toString());
> log.info("Der Transaktionsstatus vor dem createtable:
>"+transactionStatus(tx));
> log.info("Die Connection conSecurity vor dem createtable:
>"+conSecurity);
> log.info("Die Connection conContent vor dem createtable:
>"+conContent);
>
> stmt.executeUpdate(CREATE_TABLE);
> //above is the row 91 -> throws: 'java.sql.SQLException: Does
>not support SQL execution with no global transaction'
>
> stmt.close();
>
> stmt = conContent.createStatement();
> stmt.executeUpdate(CREATE_TABLE);
> stmt.close();
> commitTransaction(tx);
> }
> catch (SQLException sqle)
> {
> log.error("Konnte kein table init machen", sqle);
> rollbackTransaction(tx);
> //The Code for this method is below
> throw new EJBException(sqle);
> }
> finally
> {
> closeConnection(conSecurity);
> closeConnection(conContent);
> }
> }
>
> protected void rollbackTransaction(UserTransaction tx)
> {
> log.info("Der Transaktionsstatus vor dem Rollback:
>"+transactionStatus(tx));
> log.info("Die Transaktion vor dem Rollback: "+tx.toString());
> try
> {
> tx.rollback();
> //above is row 200 -> throws: 'java.lang.IllegalStateException:
>Transaction does not exist'
> log.info("Der Transaktionsstatus nach dem Rollback:
>"+transactionStatus(tx));
> log.info("Die Transaktion nach dem Rollback: "+tx.toString());
> }
> catch (Exception e)
> {
> log.error("Konnte die Transaktion nicht backrollen.", e);
> throw new EJBException(e);
> }
> }
>
>Log Excerpt
>===========
>INFO setupTables() (66) - Die Transaktion vor den Connections:
>[email protected]
>INFO setupTables() (67) - Der Transaktionsstatus vor den Connections:
>STATUS_NO_TRANSACTION
>INFO setupTables() (72) - Die frische Connection conSecurity:
>weblogic.jdbc.rmi.SerialConnection@7c6daa
>INFO setupTables() (73) - Die frische Connection conContent:
>weblogic.jdbc.rmi.SerialConnection@3b425
>INFO setupTables() (78) - Die Transaktion nach dem Teardown:
>[email protected]
>INFO setupTables() (79) - Der Transaktionsstatus nach dem Teardown:
>STATUS_NO_TRANSACTION
>INFO setupTables() (86) - Die Transaktion vor dem createtable:
>[email protected]
>INFO setupTables() (87) - Der Transaktionsstatus vor dem createtable:
>STATUS_NO_TRANSACTION
>INFO setupTables() (88) - Die Connection conSecurity vor dem
>createtable: weblogic.jdbc.rmi.SerialConnection@7c6daa
>INFO setupTables() (89) - Die Connection conContent vor dem
>createtable: weblogic.jdbc.rmi.SerialConnection@3b425
>ERROR setupTables() (101) - Konnte kein table init machen
>java.sql.SQLException: Does not support SQL execution with no global
>transaction
> at
>weblogic.jdbc.oci.xa.XAConnection.beforeExecute(XAConnection.java:137)
> at
>weblogic.jdbc.oci.xa.Statement.executeUpdate(Statement.java:112)
> at weblogic.jdbc.jta.Statement.executeUpdate(Statement.java:185)
> at
>weblogic.jdbc.rmi.internal.StatementImpl.executeUpdate(StatementImpl.ja
v
>a:42)
> at
>weblogic.jdbc.rmi.SerialStatement.executeUpdate(SerialStatement.java:54
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.ja
v
>a:91)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBea
n
>Impl.java:130)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCB
e
>anEOImpl.java:64)
> at
>de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseC
o
>mmitUnitTest.java:51)
> at
>org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTe
s
>tCase.java:297)
> at
>org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servl
e
>tTestCaller.java:148)
> at
>org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCa
l
>ler.java:199)
> at
>org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTe
s
>tRedirector.java:149)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl
>java:213)
> at
>weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServ
l
>etContext.java:1265)
> at
>weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl
>java:1631)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>INFO rollbackTransaction() (196) - Der Transaktionsstatus vor dem
>Rollback: STATUS_NO_TRANSACTION
>INFO rollbackTransaction() (197) - Die Transaktion vor dem Rollback:
>[email protected]
>ERROR rollbackTransaction() (206) - Konnte die Transaktion nicht
>backrollen.
>java.lang.IllegalStateException: Transaction does not exist
> at
>weblogic.transaction.internal.TransactionManagerImpl.rollback(Transacti
o
>nManagerImpl.java:228)
> at
>weblogic.transaction.internal.TransactionManagerImpl.rollback(Transacti
o
>nManagerImpl.java:222)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBean.rollbackTransaction(TP
C
>Bean.java:200)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBean.setupTables(TPCBean.ja
v
>a:102)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBeanImpl.setupTables(TPCBea
n
>Impl.java:130)
> at
>de.sitewaerts.futuna.common.test.tpcbean.TPCBeanEOImpl.setupTables(TPCB
e
>anEOImpl.java:64)
> at
>de.sitewaerts.futuna.common.test.TwoPhaseCommitUnitTest.setUp(TwoPhaseC
o
>mmitUnitTest.java:51)
> at
>org.apache.commons.cactus.AbstractTestCase.runBareServerTest(AbstractTe
s
>tCase.java:297)
> at
>org.apache.commons.cactus.server.ServletTestCaller.callTestMethod(Servl
e
>tTestCaller.java:148)
> at
>org.apache.commons.cactus.server.ServletTestCaller.doTest(ServletTestCa
l
>ler.java:199)
> at
>org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTe
s
>tRedirector.java:149)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl
>java:213)
> at
>weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServ
l
>etContext.java:1265)
> at
>weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl
>java:1631)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
>
>CONCLUSION
>==========
>I'm going nuts.
>I just don't get it.
>The transaction is the same. I don't change the Connection. I start
>the Transaction at the beginning before I do anything!
>Please guys help me out.
>Thx alot.
>
>Stefan "it's three o'clock in the morning, my girlfriend left me, and
>my only friend is that stupid linux pinguine" Siprell
>Software-Development
><<<<<<<<<<<<<<<<<<<<<<<<<<<
><sitewaerts> GmbH
>Hebelstraße 15
>D-76131 Karlsruhe
>
>Tel: +49 (721) 920 918 22
>Fax: +49 (721) 920 918 29
>http://www.sitewaerts.de
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
>
>
-
Transaction in container managed environment
I am mulitiple DAO methods to insert/update into the different tables of the same database.Every time,in each DAO method ,I am taking a connection from wsad connection pool(no XAdatasource) and returning it back to the pool at end of the method.Now,I want to enforce a transaction (CMP) made up of all these dao database update methods.So,container will automatically take care of the commit or rollback operation.Will using a single connection object across all the methods solve the purpose?Is their any other way to do it?
Call all the DAO methods from a single session bean method, this will run all the update methods under a transaction. but here forget about the number of times u may have look up for the connections. but ur transaction is managed by the container.
-
Container managed transactions in 9.0.3 (plus AQ JMS/MDB)
Something for "real programmers", similar to MDB Transaction Exception on OC4J 9.0.4 (MDB Transaction Exception on OC4J 9.0.4) but little bit different. Maybe author of the mentioned thread can find some answers here also.
We have an MDB accessing AQ in database (this works either with 9i and 8i). MDB receives the message (actually TextMessage), retrieves the content/properties and calls some EJBs making database operations. When we used just the same DataSource for JMS resource provider and SQL operations, everything worked OK. But we need to move one step further - making calls to several databases, some 8i, some might 9i. We were able to start CMT for one DataSource, i. e. configuring OrionCMTDataSource over JDBC ORACLE driver (if you use different DataSource class, message remains stucked in queue and eventually expires. If you don't specify container managed transactions for MDB in ejb-jar.xml, it works with any DataSource class - but message is lost every time exception occurs - not very pleasant situation).
We are trying to configure DataSources so they provide transactional support while using commit coordinator. There are some documents describing this - in 9iAS Data Sources and JTA, Orion Data Sources and possibly JTA description in 9i database documentation. Both ORACLE documents are very similar. Generally, these are main steps:
1) configure each data source so they provides CMT support (wrap native driver/data source by OrionCMTDataSource class)
2) create datasource commit-coordinator database, also using CMT(?)
3) create user in commit-coordinator database and same in each other database with connect, resource, create session + force any transaction priviledge (since it would commit other users transactions)
4) create database links from commit-coordinator database to each databases (but... see questions below)
5) configure commit coordinator so it uses proper data source
6) add each DB link as a property to data sources
7) configure data source for JMS
8) connect JMS resource provider with JMS data source
9) Start container, send message, etc.
So far the only result we've got is a trace file in database user dumps and generic "javax.transaction.SystemExeption: Could not commit: error code 29540". User dump occurs in a "remote" database, not the one where commit coordinator resides. If I drop database links, result is the same, so it seems like problem with data source itself. In a dump there is piece of text like this: "FATAL ERROR IN TWO-TASK SERVER: error = 12571" and "ksedmp: internal or fatal error
Current SQL statement for this session:
begin dbms_aqin.aq$_dequeue_in( :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20, :21, :22, :23, :24, :25, :26, :27, :28, :29); end; ". I think AQ call is just a coincidence since it is the first one involved in transactions. Down there in HEX part of a dump there is a message about protocol or network error ("probably ORA-28546")
Here is an example of data source configuration we are using:
<!-- Passport CMT DataSource -->
<data-source
name="PassportDS"
class="com.evermind.sql.OrionCMTDataSource"
location="jdbc/PassportDS"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="int"
password="int"
url="jdbc:oracle:thin:@ws18885:1521:ICON"
inactivity-timeout="30">
<property name="dblink" value="ICON.WS18885.APPG.COM"/>
There are some questions pending. Obvious one is if CMT is working or not at all and we should find some different solution (Bean managed transactions or use XA, hmmm). Other one might be that database link has to be "fully-qualified". I'm not sure what it means: using username and password? Using database name along with domain (if any)? So far it seems links are not used anyway.
We've tried several databases, like 9.2.0.1 and 9.0.3 versions. Result is the same.
We've tried to use XA data source of ORACLE (oracle.jdbc.xa.client.OracleXADataSource) and OrionCMT data source bound by xa-source-location to it but container gets stucked upon restart with "Investingating resource 'XADataSource PassportXADS' for recovery..." and similar messages for an hour.
There is an OracleJTADataSource mentioned in several documents, but I cannot find any in jdbc classes - was it deprecated?
Lies the problem in JMS itself? So far we've been able to use AQ in 8i and 9i and succesfully commit every transaction - provided transaction was local.
Since XA itself is working I guess problem might be with configuration.
I will appreciate any opinion on CMT... also, if you have any questions, please ask.
MyrraHi Per,
I don't have an answer for you -- sorry {:-( -- only a suggestion (which
you may have already tried, anyway :-). Have you tried running OC4J
in "debug" mode? The following web-page gives details on how to do that:
http://kb.atlassian.com/content/atlassian/howto/orionproperties.jsp
Also, if you aren't already aware of them, the following web-sites
may also be helpful (not in any particular order):
http://www.orionserver.com
http://www.orionsupport.com
http://www.elephantwalker.com
Good Luck,
Avi. -
Weblogic Explicit Transaction Management
Hi,
I am in need of managing mutiple transactions which access two different databases which are not Oracle (NON XA) but still I want to implement 2 Phase Commit.
I read documents about JTA, and tried to use TransactionManager . But I am not able to create a XaResource with my weblogic JNDI lookup. It is just return a type cast exception saying not able to convert form RmiDataSource to XaDataSource. Transaction class's enlistResource() method only accepts XaReource. Can you suggest a solution for acheving mutiple database transactions to be commited or rolledback as per need. In shot how to manage transactions explicitly in Weblogic 10.OK, now I'm catching up. Do you see that exception thrown in your calling
code, i.e. does your code as posted catch that exception?
If so, you most probably are not using the proper connection pool -- you
should be using the JTS pool not just a WL pool -- and so the connection is
not participating in the transaction.
Peace,
Cameron Purdy
Tangosol Inc.
Tangosol Coherence: Clustered Coherent Cache for J2EE
Information at http://www.tangosol.com/
"Sunil Naik" <[email protected]> wrote in message
news:3c26a505$[email protected]..
>
"Cameron Purdy" <[email protected]> wrote:
Why do you say it is not working? Do you get a compile error? An
exception?
A partial commit? Deadlock? Horse head in your bed? Out of memory?
Peace,
Hi Cameron,
Actually , while testing the method ,I am deliberately making the3 rd
method call throw an Exception and exit.In that case what I expect is thatthe
work done in the first two method calls should be rolled back. i.e.Therows should
not be inserted in the database.This is not happening.The inserts made inthe
earlier two methods are being commited.
Hope it is clear now.
Thanx,
sunil
Cameron Purdy
Tangosol Inc.
Tangosol Coherence: Clustered Coherent Cache for J2EE
Information at http://www.tangosol.com/
"Sunil Naik" <[email protected]> wrote in message
news:3c230f17$[email protected]..
Hi,
I have written a StatelessSession Bean. There is a method in thisbean
which
calls methods of Other BMP Beans.All these methods have to be partof one
Transaction.Below
I have shown in Pseudocode ,how I am handling it.
//This is the SessionBean Method
public void processDocument()
UserTransaction Utrx = SessionContext.getUserTransaction();
try
Utrx.begin();
Bean1.method1();//this method inserts a row in the database
Bean2.method2();// this method inserts a row in another table
Bean3.method3();//deletes a row
// couple of other method calls
Utrx.commit();
catch()
//catch Exceptions and rollback. -
I've developed an MDB that reads a message from a queue, performs database updates
against up to 2 databases, and sends an outgoing JMS message when all is complete.
The MDB uses container-managed transactions to ensure that all DB updates and
JMS messages are committed or rolled back together. I have had a lot of problems
related to transactions failing, becoming "in-doubt" in the database and locking
database resources indefinitely.
My environment is configured as follows:
WebLogic 8.1.2 Server
Oracle 9.2.0.4 database with RAC
XA Connection Pool with WebLogic Type 2 Oracle Driver OR Oracle 9.2.0.4
OCI Driver
I have read the BEA/HP white paper regarding Weblogic 8.1 with Oracle 9i RAC (http://dev2dev.bea.com/products/wlserver81/whitepapers/wls_bea_hp.jsp)
and have tried all of the solutions suggested in that paper. The only solution
that worked consistently without causing the in-doubt transactions was to change
my connection pools to point directly to a single node of the RAC cluster, not
to the shared instance. However, even with this configuration, I have seen these
errors occur when certain database failures occur.
A side-effect of this problem is that the associated WebLogic connection pools
begin to "forget" connections. The pool thinks that all of the connections are
in use (even though I am always calling Statement.close() and Connection.close()),
and the connection pool cannot be reset manually. The only way to clear the connection
pool is to bounce WebLogic.
The only posts I have found related to this error were regarding Oracle 8.1.7
and WebLogic 6.1. Any help would be greatly appreciated.
Exceptions:
<Mar 23, 2004 2:59:36 PM EST> <Error> <EJB> <BEA-010026> <Exception occurred during
commit of transaction Xid=BEA1-0526A28664707F28EDB9(6412513),Status=Rolled back.
[Reason=javax.transaction.xa.XAException
: prepare failed for XAResource 'ProfilingPool' with error XAER_NOTA : The XID
is not valid],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=2,seconds
left=60,XAServerResourceInfo[JMS_my
JmsStore]=(ServerResourceInfo[JMS_myJmsStore]=(state=rolledback,assigned=myserver),xar=JMS_myJmsStore),XAServerResourceInfo[ProfilingPool]=(ServerResourceInfo[ProfilingPool]=(state=rolledback,ass
igned=myserver),xar=ProfilingPool),SCInfo[mydomain+myserver]=(state=rolledback),local
properties=({}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=myserver+10.41.0.61:7001+m
ydomain+t3+, XAResources={JMS_myJmsStore, JMS_FileStore, ProfilingPool, SearchManagementPool,
AnnouncementsTxPool},NonXAResources={})],CoordinatorURL=myserver+10.41.0.61:7001+mydomain+t3+):
javax.tran
saction.xa.XAException: prepare failed for XAResource 'ProfilingPool' with error
XAER_NOTA : The XID is not valid
at weblogic.jdbc.oci.xa.XA.createException(XA.java:386)
at weblogic.jdbc.oci.xa.XADataSource.internalPrepare(XADataSource.java:905)
at weblogic.jdbc.oci.xa.XADataSource.prepare(XADataSource.java:885)
at weblogic.jdbc.jta.DataSource.prepare(DataSource.java:846)
at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerResourceInfo.java:1167)
at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerResourceInfo.java:401)
at weblogic.transaction.internal.ServerSCInfo$1.execute(ServerSCInfo.java:253)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
--------------- nested within: ------------------
weblogic.transaction.RollbackException: Could not prepare resource 'ProfilingPool
prepare failed for XAResource 'ProfilingPool' with error XAER_NOTA : The XID is
not valid - with nested exception:
[javax.transaction.xa.XAException: prepare failed for XAResource 'ProfilingPool'
with error XAER_NOTA : The XID is not valid]
at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1644)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:300)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:221)
at weblogic.ejb20.internal.MDListener.execute(MDListener.java:412)
at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:316)
at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:281)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2596)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:2516)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
2004-03-23 15:00:45,406 ERROR IS003989 [ExecuteThread: '17' for queue: 'ProfileCompleteListenerBean.ExecuteQueue']
my.package.search.business.ProfiledHoldingDAO.setProfilingStatus(ProfiledHoldingDAO.java:350
) - Failed to update profiling status for holding 10014 [] (-2)
java.sql.SQLException: ORA-02049: timeout: distributed transaction waiting for
lock
at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:282)
at weblogic.jdbc.oci.PreparedStatement.executeUpdate(PreparedStatement.java:226)
at weblogic.jdbc.oci.xa.PreparedStatement.executeUpdate(PreparedStatement.java:81)
at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:94)
at my.package.search.business.ProfiledHoldingDAO.setProfilingStatus(ProfiledHoldingDAO.java:345)
at my.package.search.business.ProfilingManager.disseminateAndAcknowledge(ProfilingManager.java:254)
at my.package.search.business.ProfileCompleteListenerBean.onMessage(ProfileCompleteListenerBean.java:128)
at weblogic.ejb20.internal.MDListener.execute(MDListener.java:382)
at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:316)
at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:281)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2596)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:2516)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
2004-03-23 15:01:43,093 ERROR IS003989 [ExecuteThread: '18' for queue: 'HoldingStatusListenerBean.ExecuteQueue']
my.package.search.business.ProfiledHoldingDAO.getProfilingStatus(ProfiledHoldingDAO.java:265)
- Failed to retrieve profiling results for holding 10060 [] (-2)
java.sql.SQLException: ORA-01591: lock held by in-doubt distributed transaction
189.47.12
at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:282)
at weblogic.jdbc.oci.PreparedStatement.executeQuery(PreparedStatement.java:152)
at weblogic.jdbc.oci.xa.PreparedStatement.executeQuery(PreparedStatement.java:48)
at weblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:80)
at my.package.search.business.ProfiledHoldingDAO.getProfilingStatus(ProfiledHoldingDAO.java:256)
at my.package.search.business.ProfiledHoldingDAO.storeHoldingMetadata(ProfiledHoldingDAO.java:489)
at my.package.search.business.ProfiledHoldingDAO.storeNewHolding(ProfiledHoldingDAO.java:406)
at my.package.search.business.ProfilingManager.profileHolding(ProfilingManager.java:128)
at my.package.search.business.HoldingStatusListenerBean.onMessage(HoldingStatusListenerBean.java:121)
at weblogic.ejb20.internal.MDListener.execute(MDListener.java:382)
at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:316)
at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:281)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2596)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:2516)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Hi. There is a serious bug in the Oracle DBMS (all versions) where in-doubt
transactions have their data locked in the DBMS by page rather than by row,
so it will indefinitely prevent access to all data on the page, including
logically uninvolved data. Oracle understands the problem but currently
says they will never fix it (it would take too much work). They offer the
alternative that you configure your table data to ensure that no more than
one datarow resides on a page.
Joe
Matt Smith wrote:
> I've developed an MDB that reads a message from a queue, performs database updates
> against up to 2 databases, and sends an outgoing JMS message when all is complete.
> The MDB uses container-managed transactions to ensure that all DB updates and
> JMS messages are committed or rolled back together. I have had a lot of problems
> related to transactions failing, becoming "in-doubt" in the database and locking
> database resources indefinitely.
>
> My environment is configured as follows:
> WebLogic 8.1.2 Server
> Oracle 9.2.0.4 database with RAC
> XA Connection Pool with WebLogic Type 2 Oracle Driver OR Oracle 9.2.0.4
> OCI Driver
>
> I have read the BEA/HP white paper regarding Weblogic 8.1 with Oracle 9i RAC (http://dev2dev.bea.com/products/wlserver81/whitepapers/wls_bea_hp.jsp)
> and have tried all of the solutions suggested in that paper. The only solution
> that worked consistently without causing the in-doubt transactions was to change
> my connection pools to point directly to a single node of the RAC cluster, not
> to the shared instance. However, even with this configuration, I have seen these
> errors occur when certain database failures occur.
>
> A side-effect of this problem is that the associated WebLogic connection pools
> begin to "forget" connections. The pool thinks that all of the connections are
> in use (even though I am always calling Statement.close() and Connection.close()),
> and the connection pool cannot be reset manually. The only way to clear the connection
> pool is to bounce WebLogic.
>
> The only posts I have found related to this error were regarding Oracle 8.1.7
> and WebLogic 6.1. Any help would be greatly appreciated.
>
> Exceptions:
> -----------------
> <Mar 23, 2004 2:59:36 PM EST> <Error> <EJB> <BEA-010026> <Exception occurred during
> commit of transaction Xid=BEA1-0526A28664707F28EDB9(6412513),Status=Rolled back.
> [Reason=javax.transaction.xa.XAException
> : prepare failed for XAResource 'ProfilingPool' with error XAER_NOTA : The XID
> is not valid],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=2,seconds
> left=60,XAServerResourceInfo[JMS_my
> JmsStore]=(ServerResourceInfo[JMS_myJmsStore]=(state=rolledback,assigned=myserver),xar=JMS_myJmsStore),XAServerResourceInfo[ProfilingPool]=(ServerResourceInfo[ProfilingPool]=(state=rolledback,ass
> igned=myserver),xar=ProfilingPool),SCInfo[mydomain+myserver]=(state=rolledback),local
> properties=({}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=myserver+10.41.0.61:7001+m
> ydomain+t3+, XAResources={JMS_myJmsStore, JMS_FileStore, ProfilingPool, SearchManagementPool,
> AnnouncementsTxPool},NonXAResources={})],CoordinatorURL=myserver+10.41.0.61:7001+mydomain+t3+):
> javax.tran
> saction.xa.XAException: prepare failed for XAResource 'ProfilingPool' with error
> XAER_NOTA : The XID is not valid
> at weblogic.jdbc.oci.xa.XA.createException(XA.java:386)
> at weblogic.jdbc.oci.xa.XADataSource.internalPrepare(XADataSource.java:905)
> at weblogic.jdbc.oci.xa.XADataSource.prepare(XADataSource.java:885)
> at weblogic.jdbc.jta.DataSource.prepare(DataSource.java:846)
> at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerResourceInfo.java:1167)
> at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerResourceInfo.java:401)
> at weblogic.transaction.internal.ServerSCInfo$1.execute(ServerSCInfo.java:253)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
> --------------- nested within: ------------------
> weblogic.transaction.RollbackException: Could not prepare resource 'ProfilingPool
> prepare failed for XAResource 'ProfilingPool' with error XAER_NOTA : The XID is
> not valid - with nested exception:
> [javax.transaction.xa.XAException: prepare failed for XAResource 'ProfilingPool'
> with error XAER_NOTA : The XID is not valid]
> at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1644)
> at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:300)
> at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:221)
> at weblogic.ejb20.internal.MDListener.execute(MDListener.java:412)
> at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:316)
> at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:281)
> at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2596)
> at weblogic.jms.client.JMSSession.execute(JMSSession.java:2516)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
> ...
> 2004-03-23 15:00:45,406 ERROR IS003989 [ExecuteThread: '17' for queue: 'ProfileCompleteListenerBean.ExecuteQueue']
> my.package.search.business.ProfiledHoldingDAO.setProfilingStatus(ProfiledHoldingDAO.java:350
> ) - Failed to update profiling status for holding 10014 [] (-2)
> java.sql.SQLException: ORA-02049: timeout: distributed transaction waiting for
> lock
> at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:282)
> at weblogic.jdbc.oci.PreparedStatement.executeUpdate(PreparedStatement.java:226)
> at weblogic.jdbc.oci.xa.PreparedStatement.executeUpdate(PreparedStatement.java:81)
> at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:94)
> at my.package.search.business.ProfiledHoldingDAO.setProfilingStatus(ProfiledHoldingDAO.java:345)
> at my.package.search.business.ProfilingManager.disseminateAndAcknowledge(ProfilingManager.java:254)
> at my.package.search.business.ProfileCompleteListenerBean.onMessage(ProfileCompleteListenerBean.java:128)
> at weblogic.ejb20.internal.MDListener.execute(MDListener.java:382)
> at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:316)
> at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:281)
> at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2596)
> at weblogic.jms.client.JMSSession.execute(JMSSession.java:2516)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
> ...
> 2004-03-23 15:01:43,093 ERROR IS003989 [ExecuteThread: '18' for queue: 'HoldingStatusListenerBean.ExecuteQueue']
> my.package.search.business.ProfiledHoldingDAO.getProfilingStatus(ProfiledHoldingDAO.java:265)
> - Failed to retrieve profiling results for holding 10060 [] (-2)
> java.sql.SQLException: ORA-01591: lock held by in-doubt distributed transaction
> 189.47.12
> at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:282)
> at weblogic.jdbc.oci.PreparedStatement.executeQuery(PreparedStatement.java:152)
> at weblogic.jdbc.oci.xa.PreparedStatement.executeQuery(PreparedStatement.java:48)
> at weblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:80)
> at my.package.search.business.ProfiledHoldingDAO.getProfilingStatus(ProfiledHoldingDAO.java:256)
> at my.package.search.business.ProfiledHoldingDAO.storeHoldingMetadata(ProfiledHoldingDAO.java:489)
> at my.package.search.business.ProfiledHoldingDAO.storeNewHolding(ProfiledHoldingDAO.java:406)
> at my.package.search.business.ProfilingManager.profileHolding(ProfilingManager.java:128)
> at my.package.search.business.HoldingStatusListenerBean.onMessage(HoldingStatusListenerBean.java:121)
> at weblogic.ejb20.internal.MDListener.execute(MDListener.java:382)
> at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:316)
> at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:281)
> at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2596)
> at weblogic.jms.client.JMSSession.execute(JMSSession.java:2516)
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
>
>
-
JTA Transaction--please help-----Xid not valid
HI,
I am writing a small application which i am posting at the end.This is decription of my application.I am writing a jsp.Later on i will be using in some other way.
I am using Oracle XA implementation to communicatewith my RM which oracle8.1.7 .
I am creating two XAConnection with two data instances 'test' and 'test3' .These two reside on my local machine in the same database server.
With the code which i am sending you i have tried two cases.
First Case
1)i use only one XAConnection object of say 'test'.
2)enlist its XADataSource with my transaction Object
3) get two connection objects and execute two sql's on themMy code works fine and maintains the transaction.
Second Case
1) I use create two XAConnection objects. one of 'test' and other of 'test3'.
2) enlist their XAResources with transaction object.
3) Now i take one connection from each of XAConnection and execute two sqls, oneon each of them.
It gives me exception while enlisting second XAResource with transaction objeectsaying that "The Xid is not valid".
below is the stackTrace.
javax.transaction.SystemException: start() failed on resource 'oracle.jdbc.xa.client.OracleXAResource':XAER_NOTA : The XID is not valid
oracle.jdbc.xa.OracleXAException at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:483)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:190)
at weblogic.transaction.internal.ServerResourceInfo.start(ServerResourceInfo.java:1165)
at weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResourceInfo.java:1108)
<----------------------CODE------------------------------------------------------>
<html>
<body bgcolor=tan>
<%@page session="true" %>
<%@page import="java.util.Hashtable,java.sql.*,javax.naming.*,javax.transaction.*,javax.sql.*,oracle.jdbc.xa.client.OracleXADataSource,javax.rmi.PortableRemoteObject,javax.transaction.xa.XAResource" %>
<%!
private static XAConnection getFirstXAConnection() throws java.sql.SQLException{
OracleXADataSource oxadsFirst = new OracleXADataSource();
String urlFirst = "jdbc:oracle:thin:@70.7.51.80:1521:test";
oxadsFirst.setURL(urlFirst);
XAConnection xaConnectionFirst = oxadsFirst.getXAConnection("scott","tiger");
return xaConnectionFirst;
private static XAConnection getSecondXAConnection() throws java.sql.SQLException{
OracleXADataSource oxadsSec= new OracleXADataSource();
String urlSec = "jdbc:oracle:thin:@70.7.51.80:1521:test3";
oxadsSec.setURL(urlSec);
XAConnection xaConnectionSec = oxadsSec.getXAConnection("scott","tiger");
return xaConnectionSec;
%>
<%
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
try{
ctx = new InitialContext(ht);
//javax.transaction.UserTransaction transaction = (javax.transaction.UserTransaction)ctx.lookup("java:comp/UserTransaction");
System.out.println("Before Lookup JNDI UserTransaction and TransactionManager......................");
//javax.transaction.UserTransaction userTx = (javax.transaction.UserTransaction)ctx.lookup("javax.transaction.UserTransaction");
javax.transaction.TransactionManager transactionManager = (javax.transaction.TransactionManager)ctx.lookup("javax.transaction.TransactionManager");
System.out.println("After Lookup TransactionManager......................");
try{
transactionManager.begin();
Transaction transaction = transactionManager.getTransaction();
System.out.println("Transaction Object ----------------------------->"+transaction);
XAConnection xaConFirst = getFirstXAConnection();
XAResource xaResourceFirst = xaConFirst.getXAResource();
System.out.println("xaResourceFirst Object ----------------------------->"+xaResourceFirst);
XAConnection xaConSecond = getSecondXAConnection();
XAResource xaResourceSecond = xaConSecond.getXAResource();
System.out.println("xaResourceSecond Object ----------------------------->"+xaResourceSecond);
if(!xaResourceFirst.isSameRM(xaResourceSecond) )
System.out.println("<-----------------BOTH THE RESOURCES ARE NOT SAME SMAE SAME----------------------------->");
boolean firstEnlistBool = transaction.enlistResource(xaResourceFirst);
System.out.println("firstEnlistBool ----------------------------->"+firstEnlistBool);
boolean secondEnlistBool = transaction.enlistResource(xaResourceSecond);
System.out.println("secondEnlistBool -------------------------> "+secondEnlistBool);
java.sql.Connection firstConn = xaConFirst.getConnection();
Statement stmt = firstConn.createStatement();
stmt.executeQuery("insert into dept values(60,'MARKETING','NEW DELHI')");
java.sql.Connection secondConn = xaConSecond.getConnection();//xaConFirst.getConnection();//
stmt = secondConn.createStatement();
//stmt.executeQuery("insert into account values(20,20)");
stmt.executeQuery("insert into salgrade values(10,10,10)");
if(Status.STATUS_ACTIVE == transactionManager.getStatus() )
System.out.println("Before committing status "+transactionManager.getStatus() );
transactionManager.commit();
System.out.println("After committing");
} catch(SQLException sqlE){
sqlE.printStackTrace();
catch(Exception e){
e.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
finally {
try {
ctx.close();
catch (Exception e) {
e.printStackTrace();
} // close finally
%>
<form method="post">
<input type="submit" name="submit" value="Call Transaction Bean">
</form>
</html>
<-------------------------------------------------------------------------------->
please help in this..I am stuck with this and dont kow how to move ahead to remove this problem..
Best Regards
Akhil NagpalHi,
Hi Vicky,
I think we are in different time zones. I am south
korea.I have tried your suggestion but it gives me
the same exception.Yes ,there is a difference of 3.5 hours , I am in India(Mumbai).
This is what i am trying to achieve.
My aim is to create some aplication to which i can
register my XADataSources and this application should
be able to handle the distributed transactions among
them.I will be using the TransactionManager of some
application server.SO i am using weblogic7.0.
For the testing purpose i have creaed a jsp as i
i posted the code. I am very new to this JTA and may
be i am doing wrong.Can you help me this but putting
insights into your experience may be that will
increase my enthusiasm :-) ....
please help me in this.
I am extracting the following from the docs
public interface TransactionManager
The TransactionManager interface defines the methods that allow an application server to manage transaction boundaries.
public interface UserTransaction
The UserTransaction interface defines the methods that allow an application to explicitly manage transaction boundaries
So as per your specs I can understands your application is trying to explicitily control the boundaries of the transaction, so you should use the UserTransction instance to begin the Transaction.My understanding says the TransactionManager will come in picture for declarative transaction and UserTransaction for the your case.I think you have tried that , I would have tried this out here but I dont work on weblogic.Do the things cooly and try to understand the concept.Let me know of the results.
Regards
Vicky
Maybe you are looking for
-
I am trying to turn off the function keys assignments in order to use them in FCP. I do not see 'Use all F1, F2, etc. keys as standard function keys' in my system settings under the keyboard tab. I am using OS 10.5. Any suggestions?
-
Changing antennas on WRT54G V8
I noticed on the WRT54G V8 that you can not remove the antennas. What is the purpose of this? How could I use hi-gain/other antennas with the router? --EDIT I just saw a thread with the same problem. Answered my question. That is SO stupid! Thanks!
-
How do install both 3.6 and 4.0 on different profiles?
I have FF 4.0. I would like to keep up with it as it improves. In the meantime, 3.6 was faster switching tabs and loading most sites. How do I load FF 3.6 and put it on a different profile.
-
Create an AdHoc network on boot
Seems like a relatively trivial thing to do, but Im having issues getting this up with either systemctl service or netcfg. netcfg fails because it's trying to connect to a network, but in actuality, it just created the AdHoc network. DEBUG: wpa_cli -
-
Why is Organizer "deleting" partial audio on video clips?
I just installed Premiere Elements and Photoshop Elements 11 a few weeks ago on my Mac desktop (Intel dual processor, OS X 10.6.8 - Snow Leopard). I am working with both standard definition and high definition clips from Panasonic camcorders. It do