Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-14924

NPE when using @Singleton @Transactional(TxType.REQUIRES_NEW)

XMLWordPrintable

    • Hide

      Deploy the following exemple in WF24.0.0.Final (using default standalone.xml) :

      @Startup @Singleton @ConcurrencyManagement(ConcurrencyManagementType.BEAN)
      @TransactionManagement(TransactionManagementType.BEAN)
      public class A {
      
          @PostConstruct
          void initialize() {
              // ex: perform database migration using Liquibase
          }
      
      }
      
      @Startup @Singleton @ConcurrencyManagement(ConcurrencyManagementType.BEAN)
      @DependsOn("A")
      public class B {
      
          @Inject
          private C c;
      
          @PostConstruct
          void initialize() {
              c.performInNewTransaction();
          }
      
      }
      
      @Singleton @ConcurrencyManagement(ConcurrencyManagementType.BEAN)
      public class C {
      
          @Transactional(TxType.REQUIRES_NEW)
          public void performInNewTransaction() {    }
      
      }
      
      <?xml version="1.0" encoding="UTF-8"?>
      <persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"
        version="2.2">
          <persistence-unit name="ExampleDS" transaction-type="JTA">
              <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
              <exclude-unlisted-classes>false</exclude-unlisted-classes>
          </persistence-unit>
      </persistence>
      Show
      Deploy the following exemple in WF24.0.0.Final (using default standalone.xml) : @Startup @Singleton @ConcurrencyManagement(ConcurrencyManagementType.BEAN) @TransactionManagement(TransactionManagementType.BEAN) public class A { @PostConstruct void initialize() { // ex: perform database migration using Liquibase } } @Startup @Singleton @ConcurrencyManagement(ConcurrencyManagementType.BEAN) @DependsOn( "A" ) public class B { @Inject private C c; @PostConstruct void initialize() { c.performInNewTransaction(); } } @Singleton @ConcurrencyManagement(ConcurrencyManagementType.BEAN) public class C { @Transactional(TxType.REQUIRES_NEW) public void performInNewTransaction() { } } <?xml version= "1.0" encoding= "UTF-8" ?> <persistence xmlns= "http: //xmlns.jcp.org/xml/ns/persistence"   xmlns:xsi= "http: //www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation= "http: //xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"   version= "2.2" >     <persistence-unit name= "ExampleDS" transaction-type= "JTA" >         <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>         <exclude-unlisted-classes> false </exclude-unlisted-classes>     </persistence-unit> </persistence>
    • Undefined

      Hi,

      We are upgrading from WF23.0.2.Final (Narayana 5.10.6) to WF24.0.0.Final (Narayana 5.12) and we stumbled on the following NPE

      Caused by: java.lang.NullPointerException
      	at org.jboss.jts//com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.getTransactional(TransactionalInterceptorBase.java:112)
      	at org.jboss.jts//com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:203)
      	at org.jboss.jts//com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorRequiresNew.doIntercept(TransactionalInterceptorRequiresNew.java:54)
      	at org.jboss.jts//com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:90)
      	at org.jboss.jts//com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorRequiresNew.intercept(TransactionalInterceptorRequiresNew.java:47)

       

      The issue seems somewhat linked to the very recent change in Narayana:

      https://github.com/jbosstm/narayana/commit/ced7cdf7431a051457202b204378e7a1a321281e#diff-bd6a83433b5079cb87b9cad6b099d1d62d6e7a2678849ab9b8973b6ff21cebd7

       

      I've attached a very simple reproducer to this issue. Let me know if I can help in any way.

       

      Thank you!

              rchakrab Ranabir Chakraborty
              mathieu@mathieulachance.com Mathieu Lachance (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: