Delved into this the only way I know how - took a quick dip in the Spring
source code. Judging by the exception message you have, it seems Spring is
not recognising the exception being thrown as one it should roll back the
transaction for and is still trying to commit the transaction. You config
looks O.K. - I would look for another transaction interceptor overriding
yours. Perhaps the AppFuse default interceptor is getting applied before
your custom interceptor?

Mike

On 9/7/07, Marco Papini <[EMAIL PROTECTED]> wrote:
>
> Hi all,
> I wish to report an issue I can't completely understand.
> In my application I created a BusinessManager to hold all business-
> logic methods that need to be ran in the same transaction, and
> declared it in applicationContext-service.xml to rollback on a
> BusinessMethodException
>
>     <tx:advice id="businessManagerTxAdvice">
>         <tx:attributes>
>             <tx:method name="process*"  read-only="false" rollback-
> for="BusinessMethodException" no-rollback-
> for="ObjectRetrievalFailureException"/>
>             <tx:method name="save*"     read-only="false" rollback-
> for="BusinessMethodException"/>
>             <tx:method name="*"         read-only="true"/>
>         </tx:attributes>
>     </tx:advice>
>
> Nothing special here, I think. Inside the process* methods, I check
> the data I have to process and I throw a new BusinessMethodException
> with a string that I can use to lookup a description in i18 properties:
>
> throw new BusinessMethodException( "errors.invalid-argument");
>
> In the action I'd like to catch the exception like this:
>
> catch(BusinessMethodException e) {
>        addActionError( getText( e.getMessage() ) );
>        return ERROR;
> }
>
> The problem is that Spring intercept the exception and overrides it,
> so in the action i don't get a BusinessMethosException but a
> UnexpectedRollbackException
>
> 08:09:03,203 ERROR (TransactionAspectSupport.java:350) - Application
> exception overridden by commit exception
> service.BusinessMethodException: batch.error.attivi
>         at
> cinetica.tism.service.impl.BusinessManagerImpl.processChangePinStatus
> (BusinessManagerImpl.java:149)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(
> AopUtils.java:318)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinp
> oint(ReflectiveMethodInvocation.
> java:203)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
> (ReflectiveMethodInvocation.java:162
> )
>         at
> org.springframework.transaction.interceptor.TransactionInterceptor.invok
> e(TransactionInterceptor.java:10
> 7)
>
> Is this the intended behaviour? Is there a way to retrieve the
> original exception?
> TIA
>
> --
> "That's thirty minutes away. I'll be there in ten." -- Mr. Wolfe
>
> Marco Papini
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to