Results 1 to 2 of 2

Thread: UnexpectedRollbackException

  1. #1
    Join Date
    Jan 2007
    Posts
    28

    Default UnexpectedRollbackException

    One of my DAO classes is throwing a DataAccessException. In this case, not finding a row to return is totally normal, but I don't want to transaction to roll back. I catch the exception and eat it but still spring gives me this error. Is there something I need to add to my txTemplate XML config to make it ignore this and not roll back?

    Code:
    Exception in thread "pool-1-thread-2" org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:626)
            at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:319)
            at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
            at $Proxy3.dispatchResourcesToJob(Unknown Source)
            at com.imageworks.spcue.dispatcher.DispatchNextFrame.run(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
            at java.lang.Thread.run(Thread.java:619)

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    If you don't want the transaction to rollback, you either need catch the exception inside the DAO and stop it bubbling up through the transactional proxy, or configure the method name match for the proxy to not rollback on this exception type.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •