-
Bug
-
Resolution: Done
-
Major
-
5.10.5.Final
-
None
If I try to apply @Transactional on a bean through InterceptionFactory like this:
interface MyService { void doSomething() throws Exception; } @Produces @ApplicationScoped public MyService myService(InterceptionFactory<MyService> interceptionFactory) { interceptionFactory.configure().add(new TransactionalLiteral(Transactional.TxType.REQUIRED)); return interceptionFactory.createInterceptedInstance(() -> System.out.println(TransactionManager.transactionManager().getStatus())); }
and call the MyService.doSomething() method somewhere in my application, I can see 0 being printed (which says that there is an active transaction) but I still get the following exception after invocation:
java.lang.NullPointerException at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.getTransactional(TransactionalInterceptorBase.java:109) at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:188) at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:168) at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:53) at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:86) at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:73) at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeAroundInvoke(InterceptorMethodHandler.java:84) at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:72) at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:56) at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:79) at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:68) at org.jboss.weld.bean.proxy.InterceptedProxyMethodHandler.invoke(InterceptedProxyMethodHandler.java:61)
The interceptor is trying to find the @Transactional annotation on the AnnotatedType but fails as it has been added via the InterceptionFactory. I know there is no easy solution as long as CDI-468 is not solved but do you think there is a workaround?
- is related to
-
WFLY-14872 Upgrade Narayana to 5.12.0.Final
- Closed