3 Replies Latest reply on May 29, 2015 11:42 AM by Tomaz Cerar

    JBoss 7 startup/shutdown dependency management

    Veit Guna Newbie



      We're migrating from JBoss 5 to JBoss 7(.1.3 final) and wondering, how/if dependency management with JBoss 7 works.


      To allow proper initialization and - more importantly - graceful shutdown of our components, we used JBoss 5 specific

      dependency declarations using jboss-dependency.xml and jboss.xml (using <depends>). With this, we could declare

      EJB-to-EJB, MDB-to-Queue, WAR-to-EJB and even EAR-to-EAR dependencies very nicely. On startup and shutdown all dependencies

      were respected accordingly - so e.g. no exceptions were encountered during shutdown and all services were dismantled

      in an appropriate order.


      It seems that this isn't possible with JBoss 7. The old descriptors aren't valid anymore and the offered alternatives

      like jboss-deployment-structure.xml and @DependsOn (JEE standard) don't seem to be sufficient.


      Using the jboss-deployment-structure.xml, it seems that this is mainly used for dependency management on classloader

      level (visibility) rather than on deployment level. Apparently one can define dependencies on deployment artifact level

      (.jars, .wars) but not on EJB level. Also MDB/EJB-to-Queue dependencies seem not possible with this configuration.


      Using @DependsOn, as per JEE spec, is limited to EJB Singletons. So one can't define e.g. MDB->EJB (non-singleton)

      dependencies as it seems.


      What we encounter during our tests is, that e.g. EJBs are shutdown before MDBs that are using them, throwing

      exceptions during shutdown like described here: https://community.jboss.org/message/819639#819639. Trying to

      use @DependsOn on the MDB referencing the EJB didn't succeed (as expected).


      Now, to come back to the origin question, are there any other ways to define dependencies within JBoss 7 as it was

      possible with JBoss 5? Maybe we have overlooked some options? What are the best practices to achieve similar

      functionality within JBoss 7?


      Some insight would be greatly appreciated.