1 Reply Latest reply on Aug 10, 2010 1:24 PM by jaikiran

    JBoss 5.1.0AS and Datasource Initialization/Service Lifecycle Ordering

    fiddleman
      Hi. I'm attempting to convert a web application that has a large number of services that has been running in JBoss 4.3.2 without incident for several years to JBoss 5.1.0. It is proving to be more difficult than expected.

      The problem that is currently blocking me is the fact that this  application dynamically registers datasources based upon a "bootstrap"  datasource defined in a -ds.xml  file and the database names contained therein. This dynamic registration/initialization takes place in the  'CREATE' lifecycle phase. Unfortunately, at this point, the datasource  defined in the -ds.xml file has not yet been registered. It would seem  that the ordering of standard JBoss datasource registration with respect  to the 'CREATE' lifecycle phase is different in 5.1.0 than 4.2.3.

      An interesting extra piece of information is that if I start JBoss  without my .WAR and .SAR files in place, the server starts up fine (and  registers the default datasources). If I then hot-deploy the  application, since the datasources are already defined, the order  dependency becomes moot. I cannot practically deploy in this way on a  production server, however, so I do need to find a solution to this  problem.

      Does anyone out there know if there a way to control this ordering  through dependencies or some other means, or is there some fundamental  rule that I was breaking in JBoss 4.2.3 that is more strictly enforced  in 5.1.0. Any assistance would be greatly appreciated.

      Thanks.

      -mark

        • 1. Re: JBoss 5.1.0AS and Datasource Initialization/Service Lifecycle Ordering
          jaikiran

          Mark Indictor wrote:

           


          Does anyone out there know if there a way to control this ordering  through dependencies or some other means,

          Yes, just add a <depends> to your *-service.xml MBean configuration. For example (picked up from JBOSS_HOME/server/< servername>/deploy/messaging/hsqldb-persistence-service.xml):

           

          <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>

           

          Replace the "DefaultDS" name in that part with the jndi-name of your datasource.