• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Transacton CMT : Rollback throws exception but does not actually rollback

 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Transacton CMT : Rollback throws exception but does not actually rollback things.


Result on server:
11:46:32,765 INFO [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)] Started in 26s:890ms
11:49:29,921 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
11:49:29,937 INFO [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)] Started in 29s:672ms

11:49:34,703 INFO [STDOUT] Before adding: Number of bids:0
11:49:34,703 INFO [STDOUT] After adding, Number of bids:1
11:49:34,703 INFO [STDOUT] Exception in getBids:bids.getSize():0
11:46:38,187 INFO [STDOUT] Exception in getBids rg.jboss.util.NestedSQLException: Transaction TransactionImple < ac, BasicAction:
7f000001:434:4959bcac:39 status: ActionStatus.ABORT_ONLY > cannot proceed STATUS_MARKED_ROLLBACK; - nested throwable:
(javax.transaction.RollbackException: Transaction TransactionImple < ac, BasicAction: 7f000001:434:4959bcac:39 status:
ActionStatus.ABORT_ONLY > cannot proceed STATUS_MARKED_ROLLBACK)
11:49:34,703 INFO [STDOUT] After rollback, Number of bids:0

11:49:42,625 INFO [STDOUT] Before adding: Number of bids:1
11:49:42,625 INFO [STDOUT] After adding, Number of bids:2
11:49:42,625 INFO [STDOUT] Exception in getBids:bids.getSize():0
11:46:38,187 INFO [STDOUT] Exception in getBids rg.jboss.util.NestedSQLException: Transaction TransactionImple < ac, BasicAction:
7f000001:434:4959bcac:39 status: ActionStatus.ABORT_ONLY > cannot proceed STATUS_MARKED_ROLLBACK; - nested throwable:
(javax.transaction.RollbackException: Transaction TransactionImple < ac, BasicAction: 7f000001:434:4959bcac:39 status:
ActionStatus.ABORT_ONLY > cannot proceed STATUS_MARKED_ROLLBACK)
11:49:42,625 INFO [STDOUT] After rollback, Number of bids:0

11:49:46,031 INFO [STDOUT] Before adding: Number of bids:2
11:49:46,031 INFO [STDOUT] After adding, Number of bids:3
11:49:46,031 INFO [STDOUT] Exception in getBids:bids.getSize():0
11:46:38,187 INFO [STDOUT] Exception in getBids rg.jboss.util.NestedSQLException: Transaction TransactionImple < ac, BasicAction:
7f000001:434:4959bcac:39 status: ActionStatus.ABORT_ONLY > cannot proceed STATUS_MARKED_ROLLBACK; - nested throwable:
(javax.transaction.RollbackException: Transaction TransactionImple < ac, BasicAction: 7f000001:434:4959bcac:39 status:
ActionStatus.ABORT_ONLY > cannot proceed STATUS_MARKED_ROLLBACK)
11:49:46,031 INFO [STDOUT] After rollback, Number of bids:0


Result on client :
[java] javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.inte
[java] at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1401)
[java] at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
[java] at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
[java] at org.jboss.tm.usertx.server.UserTransactionSessionImpl.commit(UserTransactionSessionImpl.java:172)


The above exception was thrown each time startThings() was invoked on the client side.

The things am complaing about are
a) The result i was expecting to see on server side after invoking startThing() each time was
11:28:14,375 INFO [STDOUT] Before adding: Number of bids:0
11:28:14,375 INFO [STDOUT] After adding, Number of bids:1
11:30:03,250 INFO [STDOUT] After rollback, Number of bids:1

Once i add the bid on the item and later i invoke setRollbackOnly().setRollbackOnly() sets only a flag
and does not actually rollback things. Once startThings() completes there should have been an exception
thrown at the server side. I don't know what should have been the name of this exception or wheather it
should have been logged on server side or not.But whatever it would have been it should have happened
at the end of the business method startThings(). However here there is some exception that is
thrown when i invoke getBids().

Does this mean, if a transaction has been marked for rollback and if any bean method is invoked after that
which attempts to access database, will simply throw and exception without actually accessing database?
And as a result the arrayList defined in getBids() simply returns with size 0 which is what is shown
in logs as 11:49:46,031 INFO [STDOUT] After rollback, Number of bids:0

b) This is most strangest thing. The rollback never happend with the database. A third invocation of startThing() gave 11:49:46,031 INFO [STDOUT] Before adding: Number of bids:2 . this confirms that even when the transaction was marked for rollback the data base rollback never happened.
I confirmed this behavior when i invoked getBids() from client side and it returned me a list of 4 records.

Application Server: JBOSS 4.2.3 GA. I seriously having so many issues with hands on experience with EJB.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which database server are you using? As far as i know, if you are using MySQL then it comes in 2 flavours - one which supports transactions and one which does not.
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Example is an extension of examples in EJB In Action 3.0
Since I have not yet started on Persistence, I think the book uses Hypersonic SQL.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic