10 Replies Latest reply on Oct 11, 2012 2:48 AM by Nicklas Karlsson

    @Singleton beans using @EJB's in @PreDestroy

    Jim Johnson Newbie

      I have an application we are moving from JBoss 4 to JBoss 7, and as such are taking advantage of many JEE6 features.  We currently have a handful of @Singleton annotated service beans.  These beans have various Stateless EJB's injected into them via @EJB setter injection.  Startup all seems to work fine in that Stateless beans are available in @PostConstruct calls.

       

      @PreDestroy calls are a different story.  Many times the EJB I want to use is already "gone" and thus I get a stack trace about EJBTransactionRolledBackException.  The @DependsOn annotation seems to only work for @Singleton beans that depend on other @Singleton beans, not Stateless EJBs so that isn't a solution.

       

      Has anyone else seen this?  This seems like incorrect behavior... all the EJBs for a service should be available at @PreDestroy time for a @Singleton.  At this point I'm not sure what I can do to fix this.