1 Reply Latest reply on Jun 16, 2004 3:38 PM by crosenbury

    Getting a sar to depend on a jdbc connection

    crosenbury

      I have looked for an example of this, and it either doesn't exist, or I can't figure out how to search for the right thing.

      I have a sar:

      <server>
       <mbean code="wachovia.cmg.evergreen.productmaster.ProductMasterService"
       name=":service=ProductMaster">
       <depends>jboss:service=HibernateAccess</depends>
       <depends>jboss.jca:service=RARDeployer</depends>
       <depends>jboss.jca:name=jdbc/ProductMaster,service=ManagedConnectionPool</depends>
       </mbean>
      </server>


      and a jdbc connection:
      <datasources>
       <local-tx-datasource>
       <jndi-name>jdbc/ProductMaster</jndi-name>
       <connection-url>
      jdbc:jtds:sqlserver://server:1433/dbname;SelectMethod=Cursor
       </connection-url>
       <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
       </local-tx-datasource>
      
      </datasources>

      {business specifics removed from the database connection}

      When I start the server, and deploy the service when the server is running, it finds the datasource, and works fine.

      If I restart the server with the sar already deployed, it cannot find the database connection, i presume because it has not loaded yet.

      I have tried using depends clauses for the managed connection pool, the managed connection factory, the rar deployer, and combinations of all three. Nothing seems to work.

      I would appreciate either a pointer to an example that does this, or some info on what exactly I should be depending on.

      Thanks,

      Chris Rosenbury


        • 1. Re: Getting a sar to depend on a jdbc connection
          crosenbury

          OK, I finally figured it out.

          Here is what I had to do:

          in the service.xml file, I had to add the following:

           <depends>jboss.jca:service=RARDeployer</depends>
           <depends>jboss.jca:service=LocalTxCM,name=jdbc-name</depends>
          


          I had tried this, but had the service/name flipped because that is the way it appeard in the jmx-console. I finally found a reference on the hibernate site that describes using hibernate as a service in JBoss.

          Chris