Container transaction NOT rolled back after a long period of time.
Hi, I am using Weblogic 6.1SP5 on RedHat 7.1 and I have seen an unexpected
behaviour with an MDB and I would like to know if there is any circumstance
in which a transaction is not rolled back automatically by the container
after the transaction timeout specified on MDB descriptor expired.
The fact is I have seen a thread locked for 3 entire days without any
exception being raised (the trans timeout was set to 900 seconds for
debugging porpouses)
Sadly I didn't thought on issuing a ps -ax and a netstat -np in order to see
if there was any connection active for any of the JVM threads.
As an aside note I had to throw a kill -9 to Weblogic's JVM in order to
completely stop it because using the standard "stopWeblogic.sh" script it
got stalled.
The only unusual thing that I can think of the MDB is doing is opening a
connection against a remote system via a socket.
My question is. Is it possible that a thread locked on I/O (in this case a
socket) to be out of control in terms of throwing at it a "Transaction
rolled back exception"?
I have modified my code in order to set SO_TIMEOUT on the socket just in
case the other peer hangs and never returns control. But I would like to
know the problem could be there.
I know for sure that at the time the thread stalled the other peer died
(exceptions on other MDBs trying to connect to remote system) but I expected
a "socket exception" to be thrown by the O.S. to the stalled thread instead
of having the thread waiting forever on that "open" socket.
Thanks in advance.
Ignacio.
While a tramsaction may be rolled back at the transaction timeout,
the thread is not stopped. The actual exception won't occur until
the MDB completes. If the MDB doesn't complete (as in this case),
you won't get the exception.
"Ignacio G. Dupont" <[email protected]> wrote in message news:[email protected]...
> Hi, I am using Weblogic 6.1SP5 on RedHat 7.1 and I have seen an unexpected
> behaviour with an MDB and I would like to know if there is any circumstance
> in which a transaction is not rolled back automatically by the container
> after the transaction timeout specified on MDB descriptor expired.
>
> The fact is I have seen a thread locked for 3 entire days without any
> exception being raised (the trans timeout was set to 900 seconds for
> debugging porpouses)
>
> Sadly I didn't thought on issuing a ps -ax and a netstat -np in order to see
> if there was any connection active for any of the JVM threads.
>
> As an aside note I had to throw a kill -9 to Weblogic's JVM in order to
> completely stop it because using the standard "stopWeblogic.sh" script it
> got stalled.
>
> The only unusual thing that I can think of the MDB is doing is opening a
> connection against a remote system via a socket.
>
> My question is. Is it possible that a thread locked on I/O (in this case a
> socket) to be out of control in terms of throwing at it a "Transaction
> rolled back exception"?
>
> I have modified my code in order to set SO_TIMEOUT on the socket just in
> case the other peer hangs and never returns control. But I would like to
> know the problem could be there.
>
> I know for sure that at the time the thread stalled the other peer died
> (exceptions on other MDBs trying to connect to remote system) but I expected
> a "socket exception" to be thrown by the O.S. to the stalled thread instead
> of having the thread waiting forever on that "open" socket.
>
> Thanks in advance.
>
> Ignacio.
>
>
Similar Messages
-
Stateless SessionBean Transaction not Rolling Back
I have a situation to create two Entity Beans within a single Transaction,
so I created a Session Bean to create the two Entity Beans.
I have the Session bean with attribute
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
And 2 Entity beans with attributes:
<persistence-type>Container</persistence-type>
<trans-attribute>Required</trans-attribute>
Inside the Session Bean I have a method which calls the create on the two
Entity Beans.
create ContactInfo(){
Phone ph = phoneHome.Create(phoneData);
Address ad = addressHome.Create(addressData);
When the secound bean fails to create (Key voilation), my transaction is not
getting rolled back.
The Phone Create did not roll back eventhough the address create failed.
Please give me some suggetion which transaction attributes to use
I am using Weblogic 6.0
For Create Exceptions , the transactions may or may not rollback. Mostly it
wont rollback. You have to set the sessionctx.setRollbackOnly() to mark it
for rollback in the catch block of the Create Exception.
Regards,
Swaminathan K.N.
santo comar <[email protected]> wrote in message
news:3b8dbb61$[email protected]..
> I have a situation to create two Entity Beans within a single Transaction,
> so I created a Session Bean to create the two Entity Beans.
>
> I have the Session bean with attribute
>
> <session-type>Stateless</session-type>
> <transaction-type>Container</transaction-type>
>
> And 2 Entity beans with attributes:
>
> <persistence-type>Container</persistence-type>
> <trans-attribute>Required</trans-attribute>
>
> Inside the Session Bean I have a method which calls the create on the two
> Entity Beans.
>
> create ContactInfo(){
> Phone ph = phoneHome.Create(phoneData);
> Address ad = addressHome.Create(addressData);
> }
>
> When the secound bean fails to create (Key voilation), my transaction is
not
> getting rolled back.
> The Phone Create did not roll back eventhough the address create failed.
> Please give me some suggetion which transaction attributes to use
>
> I am using Weblogic 6.0
>
>
>
-
Transaction not rolling back in stateless session bean
Hi,
I am facing a problem...
I have one stateless session bean which does multiple updates in SYBASE database.I
am using non-transactional datasource. Bean calls a method of data access obejct
whcih internally calls more than one one mehtod to update different tables.If
any of update fails then I am explicitly thorwing EJBException. Still it is not
rolling back.
I have one more application where similar situation is there but only difference
is that there we have Entity bean and updates are being done through store method.
In that case with same datasource it is rolling back perfectly.
I have tried with transactional datasource as well but it didn't work.Then I tried
to put setAutoCommit(false) in my connection class which gives me connection.But
then it is not allowing me to enter into my application.
In deployment descriptor for both the beans transaction attribute is required
for all methods.
Regards.
Rahul.
Hi,
I am facing a problem...
I have one stateless session bean which does multiple updates in SYBASE database.I
am using non-transactional datasource. Bean calls a method of data access obejct
whcih internally calls more than one one mehtod to update different tables.If
any of update fails then I am explicitly thorwing EJBException. Still it is not
rolling back.
I have one more application where similar situation is there but only difference
is that there we have Entity bean and updates are being done through store method.
In that case with same datasource it is rolling back perfectly.
I have tried with transactional datasource as well but it didn't work.Then I tried
to put setAutoCommit(false) in my connection class which gives me connection.But
then it is not allowing me to enter into my application.
In deployment descriptor for both the beans transaction attribute is required
for all methods.
Regards.
Rahul.
-
Configuration:
- WLS 5.10 SP8
- Oracle 8.1.6
- TX DataSource connected to a Connection pool of oracle JDBC connections
I have a stateless session with a method register() that performs three insert operations in the oracle database via a connection fetched from tha TX Datasource object.
The method register has been marked with the transaction attribute required.
I recieve a SQLException from Oracle when trying to insert in one of the three tables and want to rollback the transaction.
I have tried to use setRollBackOnly(), throw an EJB exception
and i get the following message from WLS:
java.sql.SQLException: ORA-00001: unique constraint (ISACOWN.UK_ISIS_REFERENCE2) violated
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java, Compiled Code)
at oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java, Compiled Code)
at oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1235)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java, Compiled Code)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1232)
at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(OracleStatement.java:1353)
at oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java, Compiled Code)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java, Compiled Code)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java, Compiled Code)
at weblogic.jdbc20.pool.PreparedStatement.executeUpdate(PreparedStatement.java:47)
at weblogic.jdbc20.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedStatementImpl.java:54)
at weblogic.jdbc20.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStatement.java:55)
at net.astrazeneca.cmi.data.Crud.execDML(Crud.java:283)
at net.astrazeneca.cmi.data.dao.MolStructDAO.insertIsisRef(MolStructDAO.java:136)
at net.astrazeneca.cmi.data.dao.MolStructDAO.insert(MolStructDAO.java, Compiled Code)
at net.astrazeneca.cmi.data.dataservice.MolStructureDS.register(MolStructureDS.java, Compiled Code)
at net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl.register(MolStructureDSEOImpl.java, Compiled Code)
at net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl_WLSkel.invoke(MolStructureDSEOImpl_WLSkel.java, Compiled Code)
at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAdapter.java, Compiled Code)
at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandler.java, Compiled Code)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java, Compiled Code)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
ti jan 23 11:12:20 GMT+01:00 2001:<I> <EJB JAR deployment F:\Projects\MolStructureDS\MolStructureDS.jar> Transaction: '980237619834_1326' rolled back
due to EJB exception:
javax.ejb.EJBException
at net.astrazeneca.cmi.data.dataservice.MolStructureDS.register(MolStructureDS.java, Compiled Code)
Anybody got an idea ? at net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl.register(MolStructureDSEOImpl.java, Compiled Code)
at net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl_WLSkel.invoke(MolStructureDSEOImpl_WLSkel.java, Compiled Code)
at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAdapter.java, Compiled Code)
at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandler.java, Compiled Code)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java, Compiled Code)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
ti jan 23 11:12:20 GMT+01:00 2001:<E> <Adapter> Exception thrown by rmi server: [-3565031217135527434S157.96.215.53:[7001,7001,7002,7002,7001,-1]/466]
javax.ejb.EJBException
at net.astrazeneca.cmi.data.dataservice.MolStructureDS.register(MolStructureDS.java, Compiled Code)
at net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl.register(MolStructureDSEOImpl.java, Compiled Code)
at net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl_WLSkel.invoke(MolStructureDSEOImpl_WLSkel.java, Compiled Code)
at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAdapter.java, Compiled Code)
at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandler.java, Compiled Code)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java, Compiled Code)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
No matter what I have tried so far the two inserts that are OK are commited in Oracle. What I want is to make all three inserts in the transaction rolled back.
Anybody got an idea ?
Yes, all through the same connection and the connection is from a TX data source in
WLS 5.1 with SP8
But.... I do NOT fetch the connection inside the transaction..but I didn't think
that was nescessery... is it ?
When I tried this and checked the JDBC log the auto-commit was turned to off and
everything worked smoothly.
/Paul
"Cameron Purdy" <[email protected]> wrote:
>All through the same connection? And the connection is from a tx data
>source? And auto-commit is off?
>
>If so, then someone is committing the transaction.
>
>Is this 5.1?
>
>--
>Cameron Purdy
>Tangosol, Inc.
>http://www.tangosol.com
>+1.617.623.5782
>WebLogic Consulting Available
>
>
>"Paul Eriksson" <[email protected]> wrote in message
>news:[email protected]...
>>
>> I've already tried this but still... the tho first inserts are commited
>and the third that causes the rollback of course is not.
>>
>> /P
>>
>> "Cameron Purdy" <[email protected]> wrote:
>> >Don't set rollback only, just throw a runtime exception (like
>EJBException).
>> >
>> >--
>> >Cameron Purdy
>> >Tangosol, Inc.
>> >http://www.tangosol.com
>> >+1.617.623.5782
>> >WebLogic Consulting Available
>> >
>> >
>> >"Paul Eriksson" <[email protected]> wrote in message
>> >news:[email protected]...
>> >>
>> >> Configuration:
>> >>
>> >> - WLS 5.10 SP8
>> >> - Oracle 8.1.6
>> >> - TX DataSource connected to a Connection pool of oracle JDBC
>connections
>> >>
>> >> I have a stateless session with a method register() that performs three
>> >insert operations in the oracle database via a connection fetched from
>tha
>> >TX Datasource object.
>> >>
>> >> The method register has been marked with the transaction attribute
>> >required.
>> >>
>> >> I recieve a SQLException from Oracle when trying to insert in one of
>the
>> >three tables and want to rollback the transaction.
>> >>
>> >>
>> >> I have tried to use setRollBackOnly(), throw an EJB exception
>> >> and i get the following message from WLS:
>> >>
>> >>
>> >> java.sql.SQLException: ORA-00001: unique constraint
>> >(ISACOWN.UK_ISIS_REFERENCE2) violated
>> >>
>> >> at
>> >oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
>> >> at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java,
>> >Compiled Code)
>> >> at oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java,
>> >Compiled Code)
>> >> at
>> >oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1235)
>> >> at
>> >oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java,
>> >Compiled Code)
>> >> at
>>
>>oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1232
>)
>> >> at
>>
>>oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(OracleStatement.java:
>1
>> >353)
>> >> at
>> >oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java,
>Compiled
>> >Code)
>> >> at
>>
>>oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.jav
>a
>> >, Compiled Code)
>> >> at
>>
>>oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStat
>e
>> >ment.java, Compiled Code)
>> >> at
>>
>>weblogic.jdbc20.pool.PreparedStatement.executeUpdate(PreparedStatement.java
>:
>> >47)
>> >> at
>>
>>weblogic.jdbc20.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedSt
>a
>> >tementImpl.java:54)
>> >> at
>>
>>weblogic.jdbc20.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedSta
>t
>> >ement.java:55)
>> >> at net.astrazeneca.cmi.data.Crud.execDML(Crud.java:283)
>> >> at
>>
>>net.astrazeneca.cmi.data.dao.MolStructDAO.insertIsisRef(MolStructDAO.java:1
>3
>> >6)
>> >> at
>> >net.astrazeneca.cmi.data.dao.MolStructDAO.insert(MolStructDAO.java,
>Compiled
>> >Code)
>> >> at
>>
>>net.astrazeneca.cmi.data.dataservice.MolStructureDS.register(MolStructureDS
>..
>> >java, Compiled Code)
>> >> at
>>
>>net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl.register(MolStruc
>t
>> >ureDSEOImpl.java, Compiled Code)
>> >> at
>>
>>net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl_WLSkel.invoke(Mol
>S
>> >tructureDSEOImpl_WLSkel.java, Compiled Code)
>> >> at
>>
>>weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAd
>a
>> >pter.java, Compiled Code)
>> >> at
>>
>>weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandl
>e
>> >r.java, Compiled Code)
>> >> at
>>
>>weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java,
>> >Compiled Code)
>> >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
>Compiled
>> >Code)
>> >> ti jan 23 11:12:20 GMT+01:00 2001:<I> <EJB JAR deployment
>> >F:\Projects\MolStructureDS\MolStructureDS.jar> Transaction:
>> >'980237619834_1326' rolled back
>> >> due to EJB exception:
>> >> javax.ejb.EJBException
>> >> at
>>
>>net.astrazeneca.cmi.data.dataservice.MolStructureDS.register(MolStructureDS
>..
>> >java, Compiled Code)
>> >>
>> >> Anybody got an idea ? at
>>
>>net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl.register(MolStruc
>t
>> >ureDSEOImpl.java, Compiled Code)
>> >> at
>>
>>net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl_WLSkel.invoke(Mol
>S
>> >tructureDSEOImpl_WLSkel.java, Compiled Code)
>> >> at
>>
>>weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAd
>a
>> >pter.java, Compiled Code)
>> >> at
>>
>>weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandl
>e
>> >r.java, Compiled Code)
>> >> at
>>
>>weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java,
>> >Compiled Code)
>> >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
>Compiled
>> >Code)
>> >>
>> >> ti jan 23 11:12:20 GMT+01:00 2001:<E> <Adapter> Exception thrown by
>rmi
>> >server:
>> >[-3565031217135527434S157.96.215.53:[7001,7001,7002,7002,7001,-1]/466]
>> >>
>> >> javax.ejb.EJBException
>> >> at
>>
>>net.astrazeneca.cmi.data.dataservice.MolStructureDS.register(MolStructureDS
>..
>> >java, Compiled Code)
>> >> at
>>
>>net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl.register(MolStruc
>t
>> >ureDSEOImpl.java, Compiled Code)
>> >> at
>>
>>net.astrazeneca.cmi.data.dataservice.MolStructureDSEOImpl_WLSkel.invoke(Mol
>S
>> >tructureDSEOImpl_WLSkel.java, Compiled Code)
>> >> at
>>
>>weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAd
>a
>> >pter.java, Compiled Code)
>> >> at
>>
>>weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandl
>e
>> >r.java, Compiled Code)
>> >> at
>>
>>weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java,
>> >Compiled Code)
>> >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
>Compiled
>> >Code)
>> >>
>> >>
>> >>
>> >> No matter what I have tried so far the two inserts that are OK are
>> >commited in Oracle. What I want is to make all three inserts in the
>> >transaction rolled back.
>> >>
>> >> Anybody got an idea ?
>> >
>> >
>>
>
>
-
My nano resets when i turn it on after a long period of time
when i turn my ipod off for a long period of time (like a day or sometimes even a few hours) it wont turn on by the play button so i have to like push the select button and it comes on with the apple logo like it resetted. why is it doing this?
Might be sleep/deep sleep you are referring to.
http://docs.info.apple.com/article.html?artnum=60945 -
Hi,
In my stateless session bean , I am calling a function which
inserts two records in the db. I am failing the second insert ,
so the previous insert should also fail. But its not happening.
I am working on WL6.1. Using datasource.
When in my code, if I say connection.setAutoCommit(false) then
it is showing me the right behaviour even if the db server have
this option disabled already. I am using Oracle thin driver.
What I am doing wrong ?
Thanks
AshwaniOk, Thanks all for your replies
Ashwani
"Raj" <[email protected]> wrote:
>
Yes, instaed of using a DAtaSource in ur config files, create a TxDatasource
and use it.
"Ashwani Kalra" <[email protected]> wrote:
"Emmanuel Proulx" <[email protected]> wrote:
Are you using a TXDataSource?
Emmanuel
"Ashwani Kalra" <[email protected]> wrote in message
news:3d1159ed$[email protected]..
Hi,
In my stateless session bean , I am calling a function which
inserts two records in the db. I am failing the second insert ,
so the previous insert should also fail. But its not happening.
I am working on WL6.1. Using datasource.
When in my code, if I say connection.setAutoCommit(false) then
it is showing me the right behaviour even if the db server have
this option disabled already. I am using Oracle thin driver.
What I am doing wrong ?
Thanks
Ashwani
No, It means if I am using normal datasource then, I have to handle itin
my code.
Cant I set this at configuration time.
Thanks
Ashwani -
How long should you leave an ipad mini plugged in to charge? How low should the battery be? Should I power it down when I am not going to be using it for several hours between uses? Thank you. I NEED to know these things.
About iPad Batteries > http://www.apple.com/batteries/ipad.html
ssutton709 wrote:
How long should you leave an ipad mini plugged in to charge? How low should the battery be?
Charge it when you see the Low Battery Alert. It is not recommended to Fully Discharge the battery.
Use Your iPad Regularly
For proper reporting of the battery’s state of charge, be sure to go through at least one charge cycle per month (charging the battery to 100% and then completely running it down).
ssutton709 wrote:
Should I power it down when I am not going to be using it for several hours between uses?
This is not necessary.
Most importantly... Enjoy your iPad -
Statement in Transaction Does Not Roll Back
I have a group of MySQL statements in a method of a Java application.
I include an SQL error in the last statement to test the rollback of the transaction.
All the statements roll back, EXCEPT for the one detailed below.
The MySQL table:
CREATE TABLE Counter (
number INT( 4 ) NOT NULL DEFAULT 0,
account_id VARCHAR( 12 ) NOT NULL PRIMARY KEY
) ENGINE = InnoDB;I have run the staement as a PreparedStatement and a Statement:
PreparedStatement:
String updateCounterStr =
" UPDATE Counter " +
" SET number = number + 1 " +
" WHERE account_id = ? "
updateCounter = con.prepareStatement ( updateCounterStr );
updateCounter.setString( 1, accountID );
int uc = updateCounter.executeUpdate(); Statement:
Statement updateCounterStatement = con.createStatement();
int updatecounter = updateCounterStatement.executeUpdate(
"UPDATE Counter SET number = number + 1 " +
"WHERE account_id = \'" + accountID + "\'"
con.setAutoCommit( true ); // ------------------------------------ Transaction ENDS
updateCounterStatement.close();
// updateCounter.close();
... several more
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
if (con != null) {
try {
System.err.print("Transaction is being ");
System.err.println("rolled back");
con.rollback(); // < ------------------------------------ con.rollback() HERE
} catch(SQLException excep) {
System.err.print("SQLException: ");
System.err.println(excep.getMessage());
} // ---------------------------------------- END the methodIn both cases Counter is incremented, but does NOT roll back.
The other statements in the transaction do roll back,
I am using:
mysql Ver 14.12 Distrib 5.0.18, for apple-darwin8.2.0 (powerpc) using readline 5.0
on Mac OS X 10.4.x
I would greatly appreciate a solution to this problem.
Many thanks in advanceI think autocommit is true by default. Also, it looks like your'e setting it to true, and then executing more SQL.
Explicitly set it to false, and DON'T set it back to trueif there's any chance you're going to want to rollback after that. -
Transaction is not Rolling Back in Stateless Session Bean
Hi,
I am using UserTransaction in Stateless Session bean .
Transaction is not rolling back.
The following code is writen in stateless session bean. In UserTransaction i am
calling Two methods of another stateless session bean.
The problem is if doJob2() method fails, doJob1() method is rolling back. These
two methods consist of SQL statement with different Connection Object from TXDataSource.And
session bean(TestSession) is set to CMT, attribute as "Required".
try{
Context ictx=new InitialContext();
TestHome home=(TestHome)ictx.lookup("TestSession");
utx = sessionCtx.getUserTransaction();
utx.begin();
TestRemote remote=home.create();
remote.doJob1();
remote.doJob2();
utx.commit();
}catch(Exception e)
try{
utx.rollback();
}catch(Exception ex)
System.out.println("unable to rollback"+ex);
if any SQL Exception as occured in doJob2(), its calling method utx.rollback()
in catch block. but SQL statements executed thru. doJob1() are not rolling back.
what might be the reason?
thanks
Ranganath
Thanx Priscilla ,
Transaction is working.
ranganath
"Priscilla Fung" <[email protected]> wrote:
>
>In your ejb-jar.xml, you should specify <transaction-type> element to
>be "Container"
>for container-managed transaction. If you specified it to be "Bean" for
>bean-managed
>transaction, EJB ontainer will suspend the caller's transaction before
>starting
>a new transaction for your doJobX() methods. Thus, doJob1()nd doJob2()
>will be
>executing in different transactions, and thus rolling back doJob2()'s
>transaction
>will have no effect on work done and committed in doJob1()'s transaction.
>
>Regards,
>
>Priscilla
>
>
>"Ranganath" <[email protected]> wrote:
>>
>>
>>
>>I am sending config.xml,deployment descriptors, code snippet for TestSession.
>>i
>>am using weblogic6.0sp2.
>>if you need any aditional info. please let me know.
>>
>>thanks
>>ranganath
>>
>>EJB-JAR.xml
>>
>><?xml version="1.0"?>
>>
>><!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise
>JavaBeans
>>1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
>>
>><ejb-jar>
>> <enterprise-beans>
>> <session>
>> <ejb-name>TestSession</ejb-name>
>> <home>com.apar.sslbridge.test.TestHome</home>
>> <remote>com.apar.sslbridge.test.TestRemote</remote>
>> <ejb-class>com.apar.sslbridge.test.TestBean</ejb-class>
>> <session-type>Stateless</session-type>
>> <transaction-type>Bean</transaction-type>
>> <resource-ref>
>> <res-ref-name>jdbc/oraclePool</res-ref-name>
>> <res-type>javax.sql.DataSource</res-type>
>> <res-auth>Container</res-auth>
>> </resource-ref>
>> </session>
>> </enterprise-beans>
>> <assembly-descriptor>
>> <container-transaction>
>> <method>
>> <ejb-name>TestSession</ejb-name>
>> <method-intf>Remote</method-intf>
>> <method-name>*</method-name>
>> </method>
>> <trans-attribute>Required</trans-attribute>
>> </container-transaction>
>> </assembly-descriptor>
>></ejb-jar>
>>
>>
>>TestSession CODE:
>>
>>
>> public void doJob1() throws RemoteException
>> {
>> Statement st = null;
>> String query=null;
>> try{
>> con=getConnection();
>> st=con.createStatement();
>> query="insert into x values("+x+++")";
>> System.out.println(query);
>> int rec=st.executeUpdate(query);
>> }catch(SQLException sqle)
>> {
>> System.out.println("SQL Exception "+sqle);
>> throw new RemoteException("RemoteException*****SQLError");
>> } catch (Exception e) {
>> System.out.println("Exception "+e);
>> throw new RemoteException("RemoteException*****GenralError");
>> }
>>}
>>
>>
>> public void doJob2()throws RemoteException
>> {
>> Connection con=null;
>> Statement st = null;
>> String query=null;
>> try{
>> con=getConnection();
>> st=con.createStatement();
>> query="insert into y values("+x+++")";
>> System.out.println(query);
>> int rec=st.executeUpdate(query);
>> }catch(SQLException sqle)
>> {
>> System.out.println("SQL Exception "+sqle);
>> throw new RemoteException("RemoteException*****SQLError");
>> } catch (Exception e) {
>> System.out.println("Exception "+e);
>> throw new RemoteException("RemoteException*****GenralError");
>>}
>>}
>>private Connection getConnection(){
>>try {
>>Connection con = StaticParams.POOL_DATASOURCE.getConnection();
>>return con;
>> } catch(Exception e) {
>> System.out.println("TestBean.getConnection() Unable to get get pool
>>connection
>>" + e);
>> }
>>}
>>
>>
>>
>>
>>"Priscilla Fung" <[email protected]> wrote:
>>>
>>>It should work if you are using TxDataSource. Could you post your
>config.xml,
>>>deployment descriptors, code snippet for TestSession?
>>>
>>>Regards,
>>>
>>>Priscilla
>>>
>>>"Ranganath" <[email protected]> wrote:
>>>>
>>>>Hi,
>>>>
>>>> I am using UserTransaction in Stateless Session bean .
>>>> Transaction is not rolling back.
>>>>
>>>>The following code is writen in stateless session bean. In UserTransaction
>>>>i am
>>>>calling Two methods of another stateless session bean.
>>>> The problem is if doJob2() method fails, doJob1() method is rolling
>>>> back. These
>>>>two methods consist of SQL statement with different Connection Object
>>>>from TXDataSource.And
>>>>session bean(TestSession) is set to CMT, attribute as "Required".
>>>>
>>>> try{
>>>> Context ictx=new InitialContext();
>>>> TestHome home=(TestHome)ictx.lookup("TestSession");
>>>> utx = sessionCtx.getUserTransaction();
>>>> utx.begin();
>>>> TestRemote remote=home.create();
>>>> remote.doJob1();
>>>> remote.doJob2();
>>>> utx.commit();
>>>> }catch(Exception e)
>>>> {
>>>> try{
>>>> utx.rollback();
>>>> }catch(Exception ex)
>>>> {
>>>> System.out.println("unable to rollback"+ex);
>>>> }
>>>> }
>>>>if any SQL Exception as occured in doJob2(), its calling method utx.rollback()
>>>>in catch block. but SQL statements executed thru. doJob1() are not
>>rolling
>>>>back.
>>>>what might be the reason?
>>>>
>>>>thanks
>>>>Ranganath
>>>
>>
>
-
Once Again: Transaction is not rolled back...
Hi all,
I'm almost at the end of my project with Toplink. but I have to solve this transaction rollback problem. Here is my previous message. any comment is more than welcome.
The problem is this, I pass 2 objects to Toplink to update in database using activeUnitOfWork.shallowMergeClone() method.
one of the updates fails then I expect everything to be rolled back within the same unitofwork. but NOT. the other object is quite well updated in database even though they are merged in the same unit of work... please HELP...
here is the log :
UnitOfWork(31228)--JTS#beforeCompletion()
UnitOfWork(31228)--#executeQuery(WriteObjectQuery(com.vnu.publitec.axis.persistence.Parameters@7a0b))
UnitOfWork(31228)--Connection(31249)--UPDATE PARAMETERS SET PARAM_VALUE = '26' WHERE (PARAM_NAME = 'TEST_PARAMETER_2')
UnitOfWork(31228)--#reconnecting to external connection pool
UnitOfWork(31228)--#executeQuery(WriteObjectQuery(com.vnu.publitec.axis.persistence.Parameters@7a06))
UnitOfWork(31228)--Connection(31249)--UPDATE PARAMETERS SET PARAM_MAX_SIZE = 666666, PARAM_COMMENTS = 'updated by new axis...', PARAM_VALUE = '18' WHERE (PARAM_NAME = 'TEST_PARAMETER_1')
UnitOfWork(31228)--EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.DatabaseException
EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-01438: value larger than specified precision allows for this column
INTERNAL EXCEPTION: java.sql.SQLException: ORA-01438: value larger than specified precision allows for this column
...... //some more message
UnitOfWork(31228)--JTS#afterCompletion()
UnitOfWork(31228)--release unit of work
ClientSession(31229)--client released
environment information is :
J2EE Server is Oracle9iAS (9.0.3.0.0) Containers for J2EE
and following is a piece of sessions.xml file related to external transaction controller settings :
<session-type>
<server-session/>
</session-type>
<login>
<datasource>java:comp/env/jdbc/xxx</datasource>
<uses-native-sql>true</uses-native-sql>
<uses-external-transaction-controller>true</uses-external-transaction-controller>
<uses-external-connection-pool>true</uses-external-connection-pool>
</login>
<external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
thanks
Erdem.Hi James,
As Erdem is not available, I am now taking care of the issue. The datasource name in session.xml refers to the one defined in OC4J data-sources.xml "ejb-location" attribute of "data-source" element. Below, I attach the relevant sections of both files
session.xml
<session>
<name>Axis_session</name>
<project-xml>AxisCDM.xml</project-xml>
<session-type>
<server-session/>
</session-type>
<login>
<datasource>java:comp/env/jdbc/AXIS_323DS</datasource>
<uses-native-sql>true</uses-native-sql>
<uses-external-transaction-controller>true</uses-external-transaction-controller>
<uses-external-connection-pool>true</uses-external-connection-pool>
</login>
<external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
data-sources.xml:
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="AXIS_323DS"
location="jdbc/AXIS_323CoreDS"
xa-location="jdbc/xa/AXIS_323XADS"
ejb-location="jdbc/AXIS_323DS"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="XXX"
password="XXX"
url="jdbc:oracle:oci8:@ddb"
inactivity-timeout="30"
connection-retry-interval="1"
/>
On the client we get the following exception:
com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: Error in transaction: EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.DatabaseException
EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-01438: value larger than specified precision allows for this column
On the server, we have implemented SessionSynchronization to monitor the transaction. afterCompletion method gets a boolean value "true" indicating that the transaction was comitted.
Any database operation that was successful before the erroneous case was saved in DB.
Thanks,
Melih -
JTA transaction unexpectedly rolled back
I have a Spring Java web app deployed on OC4J 10.1.3.3 using Toplink as the container managed persistence. When my app is launched a named query is executed that uses JPQL to load up collections of objects. It is failing with the subject line exception.
org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: Timed out
If, however, I then modify the URL and force an action that will re-execute the same query, it works fine.
Any ideas on which configuration settings I should investigage/change to enable this to work the first time through?
I am not dealing with large collections here. At this point, there are 11 main objects that have children/parents. Re-execution of the query happens very fast.
Thank you!
GinniHello,
It sounds like its not the query itself that is taking too long, but all the processing done before the query in the same transaction scope. The error is that the transaction is timing out, so you should start by checking when the transaction is started and if the timeout value needs to be increased to cover the time this process is taking, or if the transaction can be made smaller or broken up into smaller peices. Or, if the query is just returning data that isn't going to be modified, if a transaction is required at all.
Best Regards,
Chris -
OC4J / CMT - Not Rolling Back
I have a 2 JAR files deployed under one OC4J instance. JAR A contains a stateless session bean. JAR B contains a set of Entity beans. My SSLB bean uses Container manager transactions with a transaction attribute of 'Required', as do my entity beans.
When I debug the application, I see that after I call create() on one of the entity beans, from my SSLB, the new row is committed to the database, even though the calling SSLB method, which supposedly started the transaction, is not finished. I then force the transaction to Rollback, by throwing EJBEception, the logs say the transaction was rolled back, but the record still exists in the database. This has been driving me nuts!!!! Can anyone please help????
As an aside I created a kind of dummy app, with the entity bean and the sslb deployed in the same JAR file, the sslb has a declared ejb reference to the entity bean in the deployment descriptor. I can get transactions to roll back here no problem!!!!I found out what was wrong.
I was explicitly creating the context to which I was doing the entity lookup. I was using a Service Locator that was previously developed, and for OC4J environments, it was setting the dedicated.connection variable to true. This was causing the transaction created by the calling session bean to be ignored and the entity bean was creating its own transaction in which to perform its work!! Setting the dedicated.connection to false fixes this.
Just to note, the dedicated.connection setting was there as a result of trying to get Tomcat to connect to OC4J about a year ago! -
OC4J CMT not rolling back - Urgent!!
I have a 2 JAR files deployed under one OC4J instance. JAR A contains a stateless session bean. JAR B contains a set of Entity beans. My SSLB bean uses Container manager transactions with a transaction attribute of 'Required', as do my entity beans.
When I debug the application, I see that after I call create() on one of the entity beans, from my SSLB, the new row is committed to the database, even though the calling SSLB method, which supposedly started the transaction, is not finished. I then force the transaction to Rollback, by throwing EJBEception, the logs say the transaction was rolled back, but the record still exists in the database. This has been driving me nuts!!!! Can anyone please help????
As an aside I created a kind of dummy app, with the entity bean and the sslb deployed in the same JAR file, the sslb has a declared ejb reference to the entity bean in the deployment descriptor. I can get transactions to roll back here no problem!!!!I found out what was wrong.
I was explicitly creating the context to which I was doing the entity lookup. I was using a Service Locator that was previously developed, and for OC4J environments, it was setting the dedicated.connection variable to true. This was causing the transaction created by the calling session bean to be ignored and the entity bean was creating its own transaction in which to perform its work!! Setting the dedicated.connection to false fixes this.
Just to note, the dedicated.connection setting was there as a result of trying to get Tomcat to connect to OC4J about a year ago! -
Toplink 9.0.4.8 and JTS not rolling back transaction
Hi
Scenario:
I have a session bean (EJB1) calling a session bean (EJB2).
When an EJB1 is called, EJB1 persists data on to Table1 in database.
And EJB1 makes multiple calls to EJB2 to create entries in three different tables. Trans-attribute is set as required on both EJBS.
Problem:
EJB1 gets a Runtime Exception while inserting the data into TABLE1 (ORA-12899: value too large for column), EJB1 transaction is rollback, but all other transactions related to EJB2 are getting committed. I assume that they should roll back too.
Also, I did JAD on external transaction controller and listener and noticed that there is a transaction associated to each call. Meaning EJB1 had Transaction T1 and EJB2 had T2, T3, and T4 for the subsequent calls. When EJB1 is getting runtime exception in the method beforeCompletion(), the it calls rollbackGlobalTransaction() which is calling T1.setRollbackonly(). But not on on T2, T3, and T4 rollback
Am I missing anything?
Please help me
Here are my configuration details:
The datasource configuration:
<data-source name="myTxDataSource"
class="com.evermind.sql.OrionCMTDataSource"
location="jdbc/myTxDataSourceCoreDS"
xa-location="jdbc/xa/myTxDataSourceXADS"
ejb-location="jdbc/myTxDataSourceDS"
pooled-location="jdbc/myTxDataSourcePooledDS"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="duser"
password="d123"
url="jdbc:oracle:thin:@localhost:1521:ORCL"
inactivity-timeout="30"
/>
Sessions.xml
<login>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<connection-url>jdbc:oracle:thin:@localhost:1521:orcl</connection-url>
<datasource>jdbc/DimpleTxDataSourceCoreDS</datasource>
<user-name>duser</user-name>
<encryption-class-name>oracle.toplink.internal.security.JCEEncryptor</encryption-class-name>
<encrypted-password>22F7AFE6F6B9672435537CE1189E123DD62D1A19DF561D1E</encrypted-password>
<uses-native-sequencing>true</uses-native-sequencing>
<uses-external-connection-pool>true</uses-external-connection-pool>
<uses-external-transaction-controller>true</uses-external-transaction-controller>
</login>
<external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
Toplink Helper class that is used by both EJB's
This one uses SessionBroker. here is how it is initialized:
SessionManager manager = SessionManager.getManager();
sessionBroker = (SessionBroker) manager.getSession(xmlLoader,
sessionBrokerName, this.getClass().getClassLoader());
Oracle9iJTSExternalTransactionController extController = new Oracle9iJTSExternalTransactionController();
sessionBroker.setExternalTransactionController(extController);
It has common following commong methods:
public UnitOfWork getUnitOfWork() {
UnitOfWork uow = sessionBroker.getActiveUnitOfWork();
return uow;
public Object create(Object o)
UnitOfWork uow = getUnitOfWork();
uow.registerNewObject(o);
// added so that the assigned sequence number will be available before the commit happens
uow.assignSequenceNumber(o);
return o;
}Doug, Andrei and others
I found the problem. I have a Delegate that provides access to all EJBS. This delegate is used by both the webtier and middle tier.It is written in a generic fashion so that the web server and middle tier does not have to be co-located in one container. getInitialContext() which is implemented as follows:
private static Context getInitialContext() throws NamingException
// Get InitialContext for Embedded OC4J.
// The embedded server must be running for lookups to succeed.
// actual code reads from the external parameters
String contextFactory = "com.evermind.server.rmi.RMIInitialContextFactory";
String principal = "admin";
String passwd = "admin123";
String providerURL = "ormi://localhost:3201/shc";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
env.put(Context.SECURITY_PRINCIPAL, principal);
env.put(Context.SECURITY_CREDENTIALS, passwd);
env.put(Context.PROVIDER_URL, providerURL);
env.put("dedicated.rmicontext","true");
return new InitialContext(env);
When the EJB1 tries to look up for EJB2, container thinks that the call is from outside the container and it is starting a new transaction.
When I changed the EJB1 to look up EJB2 to get the context as shown below,every thing seems to rolling back.
private static Context getInitialContext() throws NamingException
return new InitialContext();
Thanks again for pointing me in the right direction.
I will post the same message in other threads.
Raju -
ORA-25402: transaction must roll back
I found this problem.ORA-25402: transaction must roll back
Please introduce , how resolve problem?
what view ? I'll able check for this problem.If you had a network problem it is unlikely that the client would still be connected and able to issue a rollback. I have seen this message but I cannot remember what the situation is when it occurs. What Oracle wants is for the client to issue an explicit rollback statement.
There is a bug that produces this error unfortunately the OP did not include their Oracle version. The bug could be in all versions from 8 - 9.2.0.3 but is only confirmed to be in 9.2.0.3 where after Transaction Failover a commit or rollback incorrectly produces this error. According to the note a Select should produce this error. This would need to be a RAC system that uses transaction failover for this to apply: Note:2652886.8 Also TAF problem: Note:2652845.8
But it seems to me you can get this error on a distributed transaction. Oracle wants the client to issue an explicit rollback so that all parties to the distributed transaction rollback. If the application terminates due to the error then RECO will rollback the transaction. If the application issues the rollback it can then continue with additional (or retry) distributed queries.
HTH -- Mark D Powell --
Maybe you are looking for
-
Dont read this if you dont want to make money
MAKE LOTS OF MONEY QUICKLY, GUARANTEED 100%, NO SCAM! Turn 6.00 into 42,000! This is true!!.... Read this carefully to find out how!!.... READING THIS WILL CHANGE YOUR LIFE! I found this on a bulletin board and decided to try it. A little while back,
-
PPC G4 iMac with WG111v2 (signal present, no internet in programs)
So, this computer used to have Tiger installed with a WG111v2 Netgear utility for wireless and worked fine. Since then, we installed Ubuntu on the machine with e17 and the wireless just worked in Linux- no need to install a driver at all. I guess BSD
-
Just Released: PeopleSoft Ent9 Financial Management, General Ledger OCE
!http://blogs.oracle.com/certification/2009-0305-1254.gif! <p align="justify">Oracle University has released the new PeopleSoft Enterprise 9 Financial Management, General Ledger Consultant Certified Expert (OCE) certification.</p> <p align="justify">
-
Output value in adobe form is / are empty
Hey gurus, I need to solve following issue: User creates an activity = task in CRM and wants to create a PDF with the task details an save it in attachments of the task I need to generate a simple adobe form and not an interactive form my steps: 1) I
-
getting error in LSMW saying "no target structures could be found" and "no target fields".help me out