[
https://issues.jboss.org/browse/WFLY-2485?page=com.atlassian.jira.plugin....
]
David Mann updated WFLY-2485:
-----------------------------
Description:
Hi,
suppose I have a @Stereotype with a @Transactional annotation:
@Named
@ViewScoped
@Transactional
@Stereotype
@Retention (RetentionPolicy.RUNTIME)
@Target (ElementType.TYPE)
public @interface Boundary
{ }
I annotate a CDI Bean with this stereotype
@Boundary
public class BusinessLogic {
public void doSomething(){
throw new RuntimeException("foo");
}
}
If any exceptions are thrown when calling the business method, the user will get the
(incorrect) info that the Class is missing a @Transactional annotation, because the
Interceptor doesn't bother to look further into the Stereotype (see below).
What's worse, the interceptor is swallowing the real exeption in the process. We get
the following Stacktrace:
java.lang.RuntimeException: ARJUNA016107: Expected an @Transactional annotation at class
and/or method level
at
com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.getTransactional(TransactionalInterceptorBase.java:61)
at
com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.handleException(TransactionalInterceptorBase.java:96)
at
com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:72)
Which is pretty clear from the implementation of TransactionalInterceptorBase:
private Transactional getTransactional(InvocationContext ic) {
Transactional transactional = ic.getMethod().getAnnotation(Transactional.class);
if (transactional != null) {
return transactional;
}
Class<?> targetClass = ic.getTarget().getClass();
transactional = targetClass.getAnnotation(Transactional.class); // needs to look
further
if (transactional != null) {
return transactional;
}
throw new
RuntimeException(jtaLogger.i18NLogger.get_expected_transactional_annotation()); //
swallows the exception that occured at ic.proceed()
}
was:
Hi,
suppose I have a @Stereotype with a @Transactional annotation:
@Named
@ViewScoped
@Transactional
@Stereotype
@Retention (RetentionPolicy.RUNTIME)
@Target (ElementType.TYPE)
public @interface Boundary
{ }
I annotate a CDI Bean with this stereotype
@Boundary
public class BusinessLogic {
public void doSomething(){
throw new RuntimeException("foo");
}
}
If any exceptions are thrown when calling the business method, the user will get the
(incorrect) info that the Class is missing a @Transactional annotation, because the
Interceptor doesn't bother to look further into the Stereotype (see below).
What's worse, the interceptor is swallowing the real exeption in the process. We get
the following Stacktrace:
java.lang.RuntimeException: ARJUNA016107: Expected an @Transactional annotation at class
and/or method level
at
com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.getTransactional(TransactionalInterceptorBase.java:61)
at
com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.handleException(TransactionalInterceptorBase.java:96)
at
com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:72)
Which is pretty clear from the implementation of TransactionalInterceptorBase (taken from
here):
private Transactional getTransactional(InvocationContext ic) {
Transactional transactional = ic.getMethod().getAnnotation(Transactional.class);
if (transactional != null) {
return transactional;
}
Class<?> targetClass = ic.getTarget().getClass();
transactional = targetClass.getAnnotation(Transactional.class); // needs to look
further
if (transactional != null) {
return transactional;
}
throw new
RuntimeException(jtaLogger.i18NLogger.get_expected_transactional_annotation()); //
swallows the exception that occured at ic.proceed()
}
@Transactional not working correctly with @Stereotype wrt. Exception
handling
-----------------------------------------------------------------------------
Key: WFLY-2485
URL:
https://issues.jboss.org/browse/WFLY-2485
Project: WildFly
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Transactions
Affects Versions: 8.0.0.Beta1
Reporter: David Mann
Assignee: Tom Jenkinson
Priority: Minor
Hi,
suppose I have a @Stereotype with a @Transactional annotation:
@Named
@ViewScoped
@Transactional
@Stereotype
@Retention (RetentionPolicy.RUNTIME)
@Target (ElementType.TYPE)
public @interface Boundary
{ }
I annotate a CDI Bean with this stereotype
@Boundary
public class BusinessLogic {
public void doSomething(){
throw new RuntimeException("foo");
}
}
If any exceptions are thrown when calling the business method, the user will get the
(incorrect) info that the Class is missing a @Transactional annotation, because the
Interceptor doesn't bother to look further into the Stereotype (see below).
What's worse, the interceptor is swallowing the real exeption in the process. We get
the following Stacktrace:
java.lang.RuntimeException: ARJUNA016107: Expected an @Transactional annotation at class
and/or method level
at
com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.getTransactional(TransactionalInterceptorBase.java:61)
at
com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.handleException(TransactionalInterceptorBase.java:96)
at
com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:72)
Which is pretty clear from the implementation of TransactionalInterceptorBase:
private Transactional getTransactional(InvocationContext ic) {
Transactional transactional = ic.getMethod().getAnnotation(Transactional.class);
if (transactional != null) {
return transactional;
}
Class<?> targetClass = ic.getTarget().getClass();
transactional = targetClass.getAnnotation(Transactional.class); // needs to look
further
if (transactional != null) {
return transactional;
}
throw new
RuntimeException(jtaLogger.i18NLogger.get_expected_transactional_annotation()); //
swallows the exception that occured at ic.proceed()
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira