Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-5074

@Inject'ed bean at another @Singleton is null on @PostConstruct (both with @Startup)

XMLWordPrintable

      module-a.jar and module-b.jar are both TL (top-level) delpoyments on JBoss AS 7.1.1

      • module-a.jar has a @Singleton/@Startup named SharedBean
      • module-b.jar has a @Singleton/@Startup named Bootstrap

      module-b.jar depends on module-a.jar through jboss-deployment-structure.xml:

      <jboss-deployment-structure>
      <delpoyment>
      <dependencies>
      <module name="deployment.module-a.jar" />
      </dependencies>
      </deployment>
      </jboss-deployment-structure>

      When I enable module-a.jar, SharedBean is started fine (it has a @PostConstruct that logs its state)

      When I enable module-b.jar, Bootstrap fails checking the @Inject'ed SharedBean on its @PostConstruct

      Files:
      -------------------------

      1. module-a.jar

      @Startup
      @Singleton
      public class SharedBean {
      @PostConstruct
      public void started()

      { LOGGER.info("SharedBean has started"); }

      }

      -------------------------

      1. module-b.jar

      @Startup
      @Singleton
      public class Bootstrap {
      @Inject
      private SharedBean sharedBean;

      @PostConstruct
      public void started()

      { LOGGER.info("sharedBean is null? " + (sharedBean == null)); }

      }

      There's no ClassNotFoundException or NoClassDefFoundError. The bean is just not injected correctly.

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              bruno.borges@gmail.com Bruno Borges (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: