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

@Singleton @Startup classes inheriting from a class containing a @PostConstruct method will not create a transaction

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 12.0.0.CR1, 12.0.0.Final
    • 9.0.0.Final, 11.0.0.Final
    • EJB
    • None

    Description

      During an update from wildfly 8.2.0.Final to 11.0.0.Final I have noticed the following issue:

      Given an abstract base class B with an @PostConstruct annotated method and a derived class D with the annotations @Singleton and @Startup. When the @PostConstruct method is called, no transaction is started.

      According to the EJB 3.2 Specification section 4.8.3, I would expect the container to start a new transaction, as the default transaction attribute is REQUIRED.

      I have attached source for a war showcasing this issue. On deploying the resulting war on a new wildfly instance, the log should contain the following two lines:

      {{14:13:06,410 INFO [stdout] (ServerService Thread Pool – 20) Singleton Hierarchy: transaction status: 6
      14:13:06,410 INFO [stdout] (ServerService Thread Pool – 58) Singleton2 Standalone: transaction status: 0}}

      A transaction status of 6 says that no transaction exists, while a transaction status of 0 implies that a transaction is ongoing. The war shows that this issue occurs only when using a class hierarchy. I expect the status 0 for both cases.

      Through testing I noticed that this issue exists since wildfly 9.0.0.Final. I could not find a reason for this behavior from the list of issues for the 9-series release, however.

      Attachments

        Activity

          People

            yborgess1@redhat.com Yeray Borges Santana
            s.czyba Christopher Czyba (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: