Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-2236

NullPointerException in CMTTxInterceptor.mandatory() method when invoked on a lifecycle callback method

XMLWordPrintable

    • Hide
      MandatoryBean.java
      package com.test;
      
      import javax.annotation.PreDestroy;
      import javax.ejb.Singleton;
      import javax.ejb.TransactionAttribute;
      import javax.ejb.TransactionAttributeType;
      
      @Singleton
      @TransactionAttribute(TransactionAttributeType.MANDATORY)
      public class MandatoryBean {
      
        @PreDestroy
        @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
        public void destroy() {
          System.out.println("Should bee called");
        }
      
        public void init() {
          System.out.println("Bean initialized");
        }
      }
      
      TestBean.java
      package com.test;
      
      import javax.annotation.PostConstruct;
      import javax.ejb.EJB;
      import javax.ejb.Singleton;
      import javax.ejb.Startup;
      
      @Singleton
      @Startup
      public class TestBean {
      
        @EJB
        MandatoryBean mb;
      
        @PostConstruct
        public void test() {
          mb.init();
        }
      }
      
      Show
      MandatoryBean.java package com.test; import javax.annotation.PreDestroy; import javax.ejb.Singleton; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; @Singleton @TransactionAttribute(TransactionAttributeType.MANDATORY) public class MandatoryBean { @PreDestroy @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void destroy() { System .out.println( "Should bee called" ); } public void init() { System .out.println( "Bean initialized" ); } } TestBean.java package com.test; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.ejb.Singleton; import javax.ejb.Startup; @Singleton @Startup public class TestBean { @EJB MandatoryBean mb; @PostConstruct public void test() { mb.init(); } }
    • tx2:0.0.2

      JBoss fails to call @PreDestroy lifecycle method, annotated with transaction attribute REQUIRES_NEW, while @Singleton bean is annotated with transaction attribute MANDATORY.

              jaikiran Jaikiran Pai (Inactive)
              vide_jira Vidas . (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: