Transaction doesn't rollback
Hello guys,
I 've a trouble and I'm not able to solve it..Ineed your help...
I have a jsf application.
I need to execute several insert query into a mysql db in a transaction, so operation must be accomplished only if all query are successfully executed.
To solve this issue I thinked to store prepared statement into an arraylist and passing it to a method that execute queries...if at least one query gives exception transaction must be rollback.
So in my code I've
ArrayList list = new ArrayList(); //collects prepared statements
PreparedStatement ps= conn.prepareStatement(....);
list.add(ps);
String result= Helper.executeTransaction(list);//I call static method to execute queries in transaction.Issue is that if a query fails during execution, exception is thrown but transaction is not rollback..so queries that has been successfully executed write into db...
This is method to execute transaction...
public static String executeTransaction(ArrayList ps) {
Connection conn = null;
String result = "success";
String allgood = "false";
try {
conn = Singleton.getInstance().getInstance().getDataSource().getConnection();
} catch (SQLException ex) {
Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex);
List results = new ArrayList();
try {
conn.setAutoCommit(false);
} catch (SQLException ex) {
Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex);
for (int i = 0; i < ps.size(); i++) {
try {
int nrows = ((java.sql.PreparedStatement) ps.get(i)).executeUpdate();
allgood = "true";
results.add(allgood);
} catch (Exception z) {
z.printStackTrace();
allgood = "false";
results.add(allgood);
for (int j = 0; j < results.size(); j++) {
if ((results.get(j)).equals("false")) {
try {
conn.rollback();
} catch (SQLException ex) {
Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex);
result = "failure";
return result;
try {
conn.commit();
} catch (SQLException ex) {
Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex);
return result;
}Debugging code seems like system arrives to conn.rollback(), but it seems like after executing correctly query data are written in the db without waiting for other queries, to estabilish if commit or rollback.
Where is the error?
Please help me
Hello guys,
thanks for your replies...
but issue isn't still clear to me...
Please correct me if I'm wrong.
Basing on what I understood from your answers I evaluated my code but I'm not able what I miss..
I set
conn.setAutoCommit(false);that mean that data are not entered into db before commit is run..
I stored all prepared statement in a list (and I think it's ok)..I iterate on list executing prepared statement and I store a boolean for each query execution (why data are entered into db if I set conn.setAutoCommit(false)?
Next I read list of boolean, if I find a "FALSE" I run
conn.rollback();
It seems correct to me...could you help me with my code?
Or at least more explanation...
Thanks
Similar Messages
-
UserTransaction doesn't rollback (JOTM)
I'm running tomcat 5.5 with SQL Server 2000. I'm working on adding transaction support through UserTransaction with JOTM.
I installed JOTM, a Transcation Manager, but it doesn't seem to work. When I try to rollback an update, it still commits it.
###My code (snippet):
Connection con = DAOUtil.getConnection();
String sqlStmt = "INSERT INTO Building (Street, City, State, Zip, CLLI, " +
"SWC, ContactName, ContactPhone, CommonName) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
PreparedStatement saveBuilding = null;
Context ctx = new InitialContext();
UserTransaction ut = (UserTransaction)ctx.lookup("java:comp/UserTransaction");
ut.begin();
saveBuilding = con.prepareStatement(sqlStmt, Statement.
RETURN_GENERATED_KEYS);
saveBuilding.setString(1, building.getStreet());
saveBuilding.execute();
ut.rollback(); //THIS DOESN'T WORK###Server.xml:
<Server>
<GlobalNamingResources>
<Resource auth="Container" name="UserTransaction"
type="javax.transaction.UserTransaction"
jotm.timeout="60"
factory="org.objectweb.jotm.UserTransactionFactory" />
<Resource name="jdbc/cafe"
type="javax.sql.DataSource"
driverClassName="net.sourceforge.jtds.jdbc.Driver"
password="XXX"
maxIdle="5"
maxWait="300"
validationQuery="Select Val From ValueItem"
username="ABC"
url="jdbc:jtds:sqlserver://SERVER_NAME:1433;
DatabaseName=ABCD;"
factory="org.objectweb.jndi.DataSourceFactory"
maxActive="10" />
</GlobalNamingResources>
</Server>###domain.xml:
<Context displayName="CaFE"
docBase="CaFE"
path="/CaFE"
reloadable="true"
workDir="C:\Tomcat-5.5\webapps\CaFE\work">
<ResourceLink global="UserTransaction"
name="UserTransaction"
type="javax.transaction.UserTransaction"/>
<ResourceLink global="jdbc/cafe"
name="jdbc/cafe"
type="javax.sql.DataSource"/>
</Context>I'm able to read/get the UserTransaction from the JNDI tree. But for some reason the transaction doesn't work.
Any ideas?
Thanks in advance.SunForumsGuest wrote:
I thought that when you're using UserTransaction that it takes care of setting autoCommit to false. Thats what I read in many places.
Anyway, when I set autoCommit to false and then call commit on the UserTransaction, it doesn't commit.
Connection con = DAOUtil.getConnection(); String sqlStmt = <font color="red">"INSERT INTO Building (Street, City, State, Zip, CLLI, "</font> + <font color="red">"SWC, <a href="http://www.blackits.net/el/travel-and-tourism/an-starter-news-regarding-the-several-pigeon-forge.html" class="bodylinkwhite"><font face="tahoma,verdana,sans-serif" size="1" color="#000">ContactName</font></a>, ContactPhone, CommonName) "</font> + <font color="red">"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"</font>; PreparedStatement saveBuilding = <font color="navy"><b>null</b></font>; Context ctx = <font color="navy"><b>new</b></font> InitialContext(); UserTransaction ut = (UserTransaction)ctx.lookup(<font color="red">"java:comp/UserTransaction"</font>); ut.begin();
con.setAutoCommit(<font color="navy"><b>false</b></font>); saveBuilding = con.prepareStatement(sqlStmt, Statement. RETURN_GENERATED_KEYS); saveBuilding.setString(1, building.getStreet()); ... saveBuilding.execute(); ut.commit(); <font color="darkgreen">//THIS DOESN'T WORK</font>
I got more deep understanding about this part, Thanks for your explanation! It's good for reference. -
Container Managed XA transaction failing to rollback
We are running two distributed instances of WL 6.0 SP1, each with their own domain,
each accessing their own Oracle 8.1.5 database instance.
Server 1 has the following transaction configuration:
JDBC Transaction Pool Driver - weblogic.jdbc.oci.xa.XADataSource
Server 2 is using the oracle thin driver, a non-XA datasource, as it's JDBC datasource.
The JDBCTxDataSource has the attribute 'EnableTwoPhaseCommit' set to 'true'.
The deployment descriptor's <transaction-type> is set to 'container' and the <trans-attribute>
is set to 'required' in both of the server's session beans.
A test is performed where server 1 calls a method on server 2, via the remote
interface, to insert a record in server 2's database. A call is then made to
a session bean in Server 1 to insert a record in server 1's database. In the call
to Server 1's bean a system level error, 'EJBException', is thrown to test if
the XA transaction driver will rollback the record inserted during the initial
call to server 2 - it does not. However, if the method sessionContext.setRollbackOnly()
is explicity called in the catch () block of server 1's method, where the call
to server 2 was made, the rollback is successful on server 2.
Is there a problem using the oracle thin driver or can the problem be related
to the version of Oracle we are using, 8.1.5 and the fact it does not support
JDBC 2.0? An additional note - if all goes well both data sources are successfully
updated.
Thanks,
Keith Denson
We are running two distributed instances of WL 6.0 SP1, each with their own domain,
each accessing their own Oracle 8.1.5 database instance.
Server 1 has the following transaction configuration:
JDBC Transaction Pool Driver - weblogic.jdbc.oci.xa.XADataSource
Server 2 is using the oracle thin driver, a non-XA datasource, as it's JDBC datasource.
The JDBCTxDataSource has the attribute 'EnableTwoPhaseCommit' set to 'true'.
The deployment descriptor's <transaction-type> is set to 'container' and the <trans-attribute>
is set to 'required' in both of the server's session beans.
A test is performed where server 1 calls a method on server 2, via the remote
interface, to insert a record in server 2's database. A call is then made to
a session bean in Server 1 to insert a record in server 1's database. In the call
to Server 1's bean a system level error, 'EJBException', is thrown to test if
the XA transaction driver will rollback the record inserted during the initial
call to server 2 - it does not. However, if the method sessionContext.setRollbackOnly()
is explicity called in the catch () block of server 1's method, where the call
to server 2 was made, the rollback is successful on server 2.
Is there a problem using the oracle thin driver or can the problem be related
to the version of Oracle we are using, 8.1.5 and the fact it does not support
JDBC 2.0? An additional note - if all goes well both data sources are successfully
updated.
Thanks,
Keith Denson
-
Getting error ORA-02067: transaction or savepoint rollback required
I am performing the task of archiving the data from one database into another database. This is being achieved by using a shell script. I run the shell script to call the procedure. After running two or three hours, I am getting the following error
ORA-02067: transaction or savepoint rollback required
Even I re-ran the job I was getting the same error.
Can any one suggest me why I am getting this error and what is the possible remedial of it ?Please post this question in General Database Discussions forum.
To get you started, here is what the documentation says about this error.
ORA-02067: transaction or savepoint rollback required
Cause: A failure (typically a trigger or stored procedure with multiple remote updates) occurred such that the all-or-nothing execution of a previous Oracle call cannot be guaranteed.
Action: rollback to a previous savepoint or rollback the transaction and resubmit. -
Transaction taking default rollback segment
Dear al,
10.2.0.4. on solaris 10
transaction taking default rollback segment
set transaction use rollback segment rbs2;
structure of rbs2:
Create rollback segment rbs2 tablespace tempt storage (initial 1M next 1M minextents 2 maxextents 1024);
alter ROLLBACK SEGMENT RBS2 STORAGE
(MINEXTENTS 20
MAXEXTENTS UNLIMITED );
set transaction use rollback segment rbs2;
when am running the query , am getting the below error :
ERROR at line 3:
ORA-01555: snapshot too old: rollback segment number 8 with name "_SYSSMU8$"
too small
why still the transaction is referring to system rollback segment "_SYSSMU8$" where I've explicitly set the rollback segment for the transactiom ?
ANy idea ?
KAIThanks robert and
Now, after setting
undo_retention integer
2700
It failed with the below and now it took 20 minutes..
ERROR at line 4:
ORA-01555: snapshot too old: rollback segment number 9 with name "_SYSSMU9$"
too small
ORA-02063: preceding line from TABS2CALLS
Elapsed: 00:20:11.40
Please advise
Kai -
Javax.transaction.RollbackException: Transaction marked for rollback
Hello all,
This is my first topic/question in the forums. I am relatively novice with J2EE programming so please pardon my ignorance. I have spend several hours thying to figure out the following issue.
So here is the scenario. I have a JSF ManagedBean called SymbolProcessBean. Here is part of its declaration
@PersistenceContext(name = "persistence/LogicalName", unitName = "MantisPU")
public class SymbolProcessBean {
@Resource
private UserTransaction utx;
}The Bean is callef by a h:command from a jsp page
<h:commandLink action="#{symbolProcessBean.processSymbol}" value="Process"/>In part of the process the Bean read data from a webpage and persists them in a MySQL database. Here is the loop:
try {
// Create a URL for the desired page
String urlStr = "http://ichart.finance.yahoo.com/table.csv?s=" + this.selectedSymbol.getTicker();
if (firstNewDay != null)
urlStr += "&a=" + firstNewDay.get(Calendar.MONTH) +
"&b=" + firstNewDay.get(Calendar.DATE) +
"&c=" + firstNewDay.get(Calendar.YEAR);
URL url = new URL(urlStr);
// Read all the text returned by the server
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String str;
outText = in.readLine() + "<br />"; // Discard first line
Context ctx = (Context) new InitialContext().lookup("java:comp/env");
utx.begin();
em = (EntityManager) ctx.lookup("persistence/LogicalName");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
while ((str = in.readLine()) != null) {
// Use togenizer to parse comma separated fields
StringTokenizer strtok = new StringTokenizer(str, ",");
// Read the data from the line
Date recordDate = formatter.parse(strtok.nextToken());
Float open = Float.valueOf(strtok.nextToken());
Float high = Float.valueOf(strtok.nextToken());
Float low = Float.valueOf(strtok.nextToken());
Float close = Float.valueOf(strtok.nextToken());
Integer volume = Integer.valueOf(strtok.nextToken());
Float adj_close = Float.valueOf(strtok.nextToken());
// Set the PriceRecord data members
PriceRecord pr = new PriceRecord();
pr.setSymbol(this.selectedSymbol);
pr.setRecordDate(recordDate);
pr.setOpen(open);
pr.setHigh(high);
pr.setLow(low);
pr.setClose(close);
pr.setVolume(volume);
pr.setAdjClose(adj_close);
// Create Record
em.persist(pr);
this.selectedSymbol.getPriceRecordCollection().add(pr);
// Add record string to output text
outText += str + "<br />";
in.close();
this.selectedSymbol = em.merge(this.selectedSymbol);
utx.commit();
} catch (Exception e) {
utx.rollback();
throw e;
}All this works fine on the first invocation of the command link and the Bean reads the data from yahoo for a Stock symbol and persists into the database. When the command link is clicked again for a different stock then the utx.commit(); throws a "javax.transaction.RollbackException: Transaction marked for rollback" exception. NOTE that when I redeploy the application and run it again it will work. But it works only the first time. The second time it will throw the exception.
I am not sure why this happens. I looked in the create() methods of the autogenerated JPA Controllers (PriceRecordJpaController) and they allways commit the transaction. Why would it fail in my case? Is there a way to "refresh" the transaction?
Thank you in advance.
Edited by: kkyriako on Nov 11, 2009 10:37 PMThank you for your responses. I had no idea that when a runtime exception is thrown the transaction will be marked for rollback. The getCause of the exception is null however I got the following stack trace from the GlashFish log:
WARNING:
Local Exception Stack:
Exception [EclipseLink-7197] (Eclipse Persistence Services - 1.0.1 (Build 20080905)): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Null primary key encountered in unit of work clone [ejb.entities.PriceRecord[idPriceRecord=null]].
at org.eclipse.persistence.exceptions.ValidationException.nullPrimaryKeyInUnitOfWorkClone(ValidationException.java:1305)
at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChanges(DeferredChangeDetectionPolicy.java:84)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.calculateChanges(UnitOfWorkImpl.java:557)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1320)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.issueSQLbeforeCompletion(UnitOfWorkImpl.java:2848)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.issueSQLbeforeCompletion(RepeatableWriteUnitOfWork.java:223)
at org.eclipse.persistence.transaction.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:157)
at org.eclipse.persistence.transaction.JTASynchronizationListener.beforeCompletion(JTASynchronizationListener.java:68)
at com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:411)
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:843)
at com.sun.enterprise.transaction.UserTransactionImpl.commit(UserTransactionImpl.java:198)
at ejb.logic.SymbolProcessBean.accessURLData(SymbolProcessBean.java:165)
at ejb.logic.SymbolProcessBean.processSymbol(SymbolProcessBean.java:182)
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 com.sun.el.parser.AstValue.invoke(AstValue.java:187)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:431)
at org.apache.catalina.core.StandardWrapperValve.preInvoke(StandardWrapperValve.java:462)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:139)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:186)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:96)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:142)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:242)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:633)
at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:570)
at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:827)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152)
at com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:71)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
at com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:325)
at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:184)SymbolProcessBean.java:165 is the utx.commit(). The idPriceRecord is the primary key of the table. It is an autoincrement field. I do not modify it before the em.persist(pr); statement so it goes as null. However the first time when I execute the commit everything is persisted in the database. When I run a second time for a different symbol then I get the exception until I redeploy the wed site. Maybe the persistence layer does not update the idPriceRecord with the value generated by MySQL. Nuy why does that does not cause a problem the first time? -
BC_DATA_GEN Transaction doesn't exist
I'm trying to populate SFLIGHT table with data in a R/3 4.6B installation and after heving execute BC_DATA_GEN Tcode, it gives me an error "transaction doesn't exist"
Any idea on why does it happen?
thanxDo you see the report
SAPBC_DATA_GENERATOR
in your installation?
Probably, before the 6.20 release there is another program:
S_FLIGHT_MODEL_DATA_GENERATOR
Try it and remember to add the following number range intervals:
SBOOKID, SCUSTOMID, SBUSPID, SFLTRIPID. You may have to create these (transaction SNRO) before executing the report.
Message was edited by:
Sergio Locatelli -
ORA-02067: transaction or savepoint rollback required
I am performing the task of archiving the data from one database into another database. This is being achieved by using a shell script. I run the shell script to call the procedure. After running two or three hours, I am getting the following error
ORA-02067: transaction or savepoint rollback required
Even I re-ran the job I was getting the same error.
Can any one suggest me why I am getting this error and what is the possible remedial of it ?No version number.
No operating system or hardware information.
No information as to whether both databases are on the same machine.
No information as to what the shell script does.
No information as to what the procedure does.
No information as to how communication between the databases is established.
And you want us to tell you what you are doing wrong? <g> -
[EMF Transaction] Exception during rollback
On a number of occasions we have faced some exception during rollback, if our code encounters an exception while processing the transaction.
Here is a very typical example:
org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException: index=1, size=1
at org.eclipse.emf.common.util.BasicEList.remove(BasicEList.java:602)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.doRemove(NotifyingListImpl.java:756)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.remove(NotifyingListImpl.java:707)
at org.eclipse.emf.ecore.change.impl.ListChangeImpl.process(ListChangeImpl.java:546)
at org.eclipse.emf.ecore.change.impl.ListChangeImpl.apply(ListChangeImpl.java:476)
at org.eclipse.emf.ecore.change.impl.FeatureChangeImpl.apply(FeatureChangeImpl.java:701)
at org.eclipse.emf.ecore.change.impl.FeatureChangeImpl.process(FeatureChangeImpl.java:611)
at org.eclipse.emf.ecore.change.impl.FeatureChangeImpl.apply(FeatureChangeImpl.java:518)
at org.eclipse.emf.ecore.change.impl.FeatureChangeImpl.apply(FeatureChangeImpl.java:493)
at org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.apply(ChangeDescriptionImpl.java:300)
at org.eclipse.emf.transaction.util.CompositeChangeDescription.apply(CompositeChangeDescription.java:104)
at org.eclipse.emf.transaction.impl.TransactionImpl.doRollback(TransactionImpl.java:570)
at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:417)
at org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl.doExecute(TransactionalCommandStackImpl.java:70)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
at org.eclipse.emf.emfstore.internal.client.transaction.EMFStoreTransactionalCommandStack.execute(EMFStoreTransactionalCommandStack.java:52)
This seems to be caused by an attempt to remove an element from a list. Debugging here is showing that the rollback is trying to apply the undo changes produced by the transaction recorder. But the element that it is attempting to remove doesn't exist in the list, and thus the error. I suspect that this is because when the initial exception occurred that this command had not been executed yet. If that is the case, I would expect the rollback to have a way to check for the commands that have completed and to reverse them, but to ignore any commands that have never completed yet. Is it what I might be saying and what is the solution?
I'm adding below portion of the stacktrace that represents the original exception that triggered the rollback. This might help a bit in understanding the situation.
Caused by: java.lang.ClassCastException: ....
at com.castortech.util.emf.VersioningUtils.runInCompositeOperation(VersioningUtils.java:83)
at org.eclipse.sirius.table.business.internal.dialect.TableDialectServices.refresh(TableDialectServices.java:272)
at org.eclipse.sirius.business.internal.dialect.DialectManagerImpl.refresh(DialectManagerImpl.java:106)
at org.eclipse.sirius.business.api.dialect.command.RefreshRepresentationsCommand.doExecute(RefreshRepresentationsCommand.java:85)
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
at org.eclipse.emf.common.command.CompoundCommand.execute(CompoundCommand.java:261)
at org.eclipse.sirius.business.internal.session.SessionEventBrokerImpl$PreCommitPriorityNotifyListenersCommand.launchCommands(SessionEventBrokerImpl.java:251)
at org.eclipse.sirius.business.internal.session.SessionEventBrokerImpl$PreCommitPriorityNotifyListenersCommand.doExecute(SessionEventBrokerImpl.java:242)
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
at org.eclipse.emf.transaction.util.TriggerCommand.execute(TriggerCommand.java:113)
at org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl.executeTriggers(TransactionalCommandStackImpl.java:218)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.precommit(TransactionalEditingDomainImpl.java:712)
at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:414)
at org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl.doExecute(TransactionalCommandStackImpl.java:70)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
at org.eclipse.emf.emfstore.internal.client.transaction.EMFStoreTransactionalCommandStack.execute(EMFStoreTransactionalCommandStack.java:52)
Thanks
AlainHi, Alain,
Indeed, the transaction will have difficulty rolling back if the
ChangeDescription cannot successfully be applied. However, a
ChangeDescription records only changes that actually are effected in
the model. I don't know how it could record changes that haven't yet
occurred.
Does your model have custom implementations of some of these list
features, as UML2 does, that perhaps coordinate changes with other
features? Could it be that undoing some changes causes side-effects in
others that then invalidate changes recorded in those?
Or are there non-ChangeDescription-based commands being undone by the
transaction that could interfere with ChangeDescriptions?
There's not really much that a transaction can do to validate the
applicability of a ChangeDescription ... it seems to me that it's up to
the model and the commands captured by a transaction to ensure that
undo will happen correctly. Although, perhaps failed rollback could
somehow be handled more gracefully? I'm not sure.
Cheers,
Christian
On 2015-08-08 18:12:21 +0000, Alain Picard said:
> On a number of occasions we have faced some exception during rollback,
> if our code encounters an exception while processing the transaction.
> Here is a very typical example:
>
>
> org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException:
> index=1, size=1
> at org.eclipse.emf.common.util.BasicEList.remove(BasicEList.java:602)
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.doRemove(NotifyingListImpl.java:756)
>
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.remove(NotifyingListImpl.java:707)
>
> at
> org.eclipse.emf.ecore.change.impl.ListChangeImpl.process(ListChangeImpl.java:546)
>
> at
> org.eclipse.emf.ecore.change.impl.ListChangeImpl.apply(ListChangeImpl.java:476)
>
> at
> org.eclipse.emf.ecore.change.impl.FeatureChangeImpl.apply(FeatureChangeImpl.java:701)
>
> at
> org.eclipse.emf.ecore.change.impl.FeatureChangeImpl.process(FeatureChangeImpl.java:611)
>
> at
> org.eclipse.emf.ecore.change.impl.FeatureChangeImpl.apply(FeatureChangeImpl.java:518)
>
> at
> org.eclipse.emf.ecore.change.impl.FeatureChangeImpl.apply(FeatureChangeImpl.java:493)
>
> at
> org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.apply(ChangeDescriptionImpl.java:300)
>
> at
> org.eclipse.emf.transaction.util.CompositeChangeDescription.apply(CompositeChangeDescription.java:104)
>
> at
> org.eclipse.emf.transaction.impl.TransactionImpl.doRollback(TransactionImpl.java:570)
>
> at
> org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:417)
>
> at
> org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl.doExecute(TransactionalCommandStackImpl.java:70)
>
> at
> org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
>
> at
> org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
>
> at
> org.eclipse.emf.emfstore.internal.client.transaction.EMFStoreTransactionalCommandStack.execute(EMFStoreTransactionalCommandStack.java:52)
>
>
>
> This seems to be caused by an attempt to remove an element from a list.
> Debugging here is showing that the rollback is trying to apply the undo
> changes produced by the transaction recorder. But the element that it
> is attempting to remove doesn't exist in the list, and thus the error.
> I suspect that this is because when the initial exception occurred that
> this command had not been executed yet. If that is the case, I would
> expect the rollback to have a way to check for the commands that have
> completed and to reverse them, but to ignore any commands that have
> never completed yet. Is it what I might be saying and what is the
> solution?
>
> I'm adding below portion of the stacktrace that represents the original
> exception that triggered the rollback. This might help a bit in
> understanding the situation.
>
> Caused by: java.lang.ClassCastException: ....
> ...
> at
> com.castortech.util.emf.VersioningUtils.runInCompositeOperation(VersioningUtils.java:83)
>
> at
> org.eclipse.sirius.table.business.internal.dialect.TableDialectServices.refresh(TableDialectServices.java:272)
>
> at
> org.eclipse.sirius.business.internal.dialect.DialectManagerImpl.refresh(DialectManagerImpl.java:106)
>
> at
> org.eclipse.sirius.business.api.dialect.command.RefreshRepresentationsCommand.doExecute(RefreshRepresentationsCommand.java:85)
>
> at
> org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
>
> at
> org.eclipse.emf.common.command.CompoundCommand.execute(CompoundCommand.java:261)
>
> at
> org.eclipse.sirius.business.internal.session.SessionEventBrokerImpl$PreCommitPriorityNotifyListenersCommand.launchCommands(SessionEventBrokerImpl.java:251)
>
> at
> org.eclipse.sirius.business.internal.session.SessionEventBrokerImpl$PreCommitPriorityNotifyListenersCommand.doExecute(SessionEventBrokerImpl.java:242)
>
> at
> org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
>
> at
> org.eclipse.emf.transaction.util.TriggerCommand.execute(TriggerCommand.java:113)
>
> at
> org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl.executeTriggers(TransactionalCommandStackImpl.java:218)
>
> at
> org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.precommit(TransactionalEditingDomainImpl.java:712)
>
> at
> org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:414)
>
> at
> org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl.doExecute(TransactionalCommandStackImpl.java:70)
>
> at
> org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
>
> at
> org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
>
> at
> org.eclipse.emf.emfstore.internal.client.transaction.EMFStoreTransactionalCommandStack.execute(EMFStoreTransactionalCommandStack.java:52)
>
>
>
> Thanks
> Alain -
Transaction doesn't roll back to Oracle
Hello, I would like to ask does webloogic support transaction controlled by client
which is out of container? My case is that i use UserTransaction in the client
application(not within bean). Bean methods (CMP) are invoked between the UserTransaction.begin()
and UserTransaction.rollback(). However, row are inserted into database and the
rollback fail at the end.
Any ideas?
Thanks
Joseph Weinstein <[email protected]> wrote:
>
>
>Leo Choi wrote:
>
>> Hello, I would like to ask does webloogic support transaction controlled
>by client
>> which is out of container? My case is that i use UserTransaction in
>the client
>> application(not within bean). Bean methods (CMP) are invoked between
>the UserTransaction.begin()
>> and UserTransaction.rollback(). However, row are inserted into database
>and the
>> rollback fail at the end.
>>
>> Any ideas?
>
>I assume you get the UserTransaction from Weblogic. How are the bean's
>transactional
>behavior specified? TX-SUPPORTS, TX-REQUIRES, etc? What version of weblogic
>are you running? To answer your question in the general, if the beans
>are involved in the
>transaction, then all DBMS updates they do should roll back if you roll
>back the UserTransaction.
>If, however, the beans are not part of the tx, such as if they are marked
>as TX-REQUIRES-NEW,
>then each invoke of the bean will start it's own tx during the invoke,
>and commit it separately
>at each method, so any later rollback of the bigger tx won't involve
>any of the little
>already-committed
>EJB tx's...
>Joe
>
>>
>>
>> Thanks
>
Thanks for you reply. I am new to transaction.
The version i am using is 7.0. I get the UserTransaction by ctx.lookup("UserTransaciton......)
where ctx is the InitialContext.
You are right, i found that the transaction is committed at each method.
If i call setRollBackOnly() before calling the bean method, the transaction
cannot committed.
But it is meaningless to me since the transaction should be able to roll
back at any points before the UserTansaction.commit();
TX-SUPPORTS, TX_REQUIRES....are you talking about the deployment descriptor?
I have check the deployment descriptor, the transaction attr is Required.
The rollback() method doesnt work. Are there any things missing?
Thanks
-
OSP Recipt Transaction Doesn't Always Perform The Move/Complete Process
Random occurrences.
Have OSP Deliver transactions that move the work order quantity to the To Move operation step but doesn't complete the work order.
The work orders have completion subinventories.
They are typically not over completion transactions.
One resource and one op-item.
The resource charge type is PO Move
Sometimes it works and sometimes it doesn't
Can't find anything specific in MetaLink.
Any thoughts
Thanks in advanceunderstood
the last operation in this instance is galvanizing.
the same osp-resource and thus osp-item is used in many different assemblies that go for this process.
it is a random occurrence when they receiving transaction is performed...the wip move takes quantity and puts it into the To Move intraoperation step...but the work order does not complete.
it can not be reproduced in a recent clone instance -
PPCI transaction doesn't work perfectly....WHY??
Hi experts!!!
I'm following the steps of OMINFOTYPES docuemntation that I've found in this forum, but transaction PPCI doesn't work, I've created the structure of my new infotype and the table associated to this HRI, after I execute PPCI transaction, and I only received a message, that say... "Infotype 9010 cannot be created. Please look at the following log" and then it shows me the log and I don't have created PT9010 structure, either table HRPT9010, HRP9010 created in the database, Modulpoool....etc,.
Can anybody explain me why I need to use PPCI transaction? Is this working properly?
thanlks a lot,
Regards
rebecaHello Rebeca.
I'm getting exactly the same message in PPCI (ECC 6.0)
Were you able to solve PPCI problem?
Thank you,
Irina -
Disabling UNDO altogether so long running transactions have no rollback
Hi, we have a large Oracle 11g database that we use only to demo our product to potential customers. It's not an important database as far as the quality of the data, it serves its purpose. Well every night we run a script to increment all the date fields in the database so our demos are predictable for our sales people. This date rolling results in a huge UNDO tablespace and we really can't justify the space to house it. How can I turn off transactions altogether so long running queries just commit row by row with no rollback and no writing to the undo tablespace?
Yes:
Oracle saves undo data at least until the transaction has been committed. Until this time, the undo data is in the active state. Therefore, the amount of space available in the undo tablespace should be at least large enough to hold the active undo data generated by current transactions. Otherwise, some of these transactions might fail. When active undo data is stored in the undo tablespace, Oracle automatically ensures that it is never overwritten until the corresponding transaction has been committed.
From http://download.oracle.com/docs/cd/B19306_01/server.102/b14196/storage003.htm. -
Transaction table in rollback segments
hi guys,
I have read the following, but am still having a little difficulty conceptualising. Would someone be kind enough to give me a very brief example?
thanks
For each rollback segment, Oracle maintains a transaction table--a list of all transactions that use the associated rollback segment and the rollback entries for each change performed by these transactions.First of all, the statement is talking about old manual undo management using rollback segment.
If you check the preceding two paragraph of the statement then it's easier to understand,
It basically says, Rollback segment hold rollback entries of transaction. To make it easier to track transactions and undo entries, Oracle maintain a table to save such info.
Rollback segment , transaction and undo entries are one to many relationships.
Rollback Segment --< Transactions --< Undo Entries
http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/b_deprec.htm
Contents of a Rollback Segment
Information in a rollback segment consists of several rollback entries. Among other information, a rollback entry includes block information (the file number and block ID corresponding to the data that was changed) and the data as it existed before an operation in a transaction. Oracle links rollback entries for the same transaction, so the entries can be found easily if necessary for transaction rollback.
Neither database users nor administrators can access or read rollback segments. Only Oracle can write to or read them. (They are owned by the user SYS, no matter which user creates them.)
How Rollback Entries Are Logged
Rollback entries change data blocks in the rollback segment, and Oracle records all changes to data blocks, including rollback entries, in the redo log. This second recording of the rollback information is very important for active transactions (not yet committed or rolled back) at the time of a system crash. If a system crash occurs, then Oracle automatically restores the rollback segment information, including the rollback entries for active transactions, as part of instance or media recovery. When recovery is complete, Oracle performs the actual rollbacks of transactions that had been neither committed nor rolled back at the time of the system crash.
When Rollback Information Is Required
For each rollback segment, Oracle maintains a transaction table--a list of all transactions that use the associated rollback segment and the rollback entries for each change performed by these transactions. Oracle uses the rollback entries in a rollback segment to perform a transaction rollback and to create read-consistent results for queries. -
Container Managed Transaction locking Database- RollBack
Hi,
I am trying to call a Stateless Session Bean (B) in domain D2 from another stateless session bean (A) in domain 1 within a transaction.
The <trans-attribute> in both ejb-jar.xmls is "Required".
Bean B accesses the Database and the method is successful in inserting the record ( not comitted ) , but the database is getting locked due to which the transaction is rolling back.
Any pointers in this regard is greatly appreciated.
Regards,
HarshaHi,
I guess that there is a problem with your JMS provider and that the message would not be enqueued if the connection is not closed before the exception is raised. If it is the case then I would recommend you to report this problem to your JMS provider.
Arnaud
Maybe you are looking for
-
How do I transfer my iPhoto library from my old Mac Book to my new Mac Book Pro?
I took delivery of my new mac Book Pro at the weekend and was unable to transfer all my data from my old machine at the time of set-up. Can someone tell me how I can transfer my iPhoto library to my new machine while keeping all photos in the events
-
How can I disable start up sound?
how can I disable start up sound?
-
Adobe Error Message - Referenced Memory
Hi. I am using adobe premiere elements 2.0 as a nonlinear non-proprietary editing program. I love the program and it has been great for the small editing projects I have to do. However, I am receiving a new error message from the program when I cl
-
I have spent the whole day fixing small problems with a CS4 INDB opened in CS6 1) Can't save changes: I had a problem with one word of text that had slipped to the wrong side of a text wrapped box. Fixed the problem and saved. When I re-opened the do
-
Attaching music files to an email message
Can anyone tell me how to attach a music file from my iTunes library to an email message? Also, I would like to convert the file so that it can be played on a PC? Thanks for any assistance.