6 Replies Latest reply on Mar 24, 2011 4:12 PM by oourfali

    jboss enterprise application startup when DB is down

    oourfali

      Hey,

       

      I have an enterprise application running on jboss, connecting to a remote database.

       

      In case the database is down when starting jboss, the application fails to start, and if the database is up later it won't help. Currently, starting jboss when the database is down cannot be recovered.

       

      Is there a way to retry deploying my application from time to time, to make sure that it will start when the database comes back to life?

       

      Thank you,

      Oved

        • 1. jboss enterprise application startup when DB is down
          wdfink

          AFAIK the only way is (with hotdeploy) to touch the application, but I know that this is not a good idea because it is difficult to note whether the DB connections are up.

          A flush of the ConnectionPool will not help (JB4.x) because the application is not deployed afterwards.

           

          As this is a seldom problem we decide in this case to start the JBoss complete if the DB is up and running.

           

          If the problem happen during the application is running it will recover the ConnectionPool automaticaly.

          1 of 1 people found this helpful
          • 2. jboss enterprise application startup when DB is down
            oourfali

            Can't I add a dependency that if my data source is not reachable then my application won't try to start? And when the connection pool is up it will try to start?

            • 3. jboss enterprise application startup when DB is down
              wdfink

              I've experimented a bit.

              If the DB is not available the *-ds will not be deployed.

              The EJB2 persistence jar depend on the DS and is also not deployed.

              If the DB is available again --> NOTHING happen

              If I touch the *-ds.xml afterwards, the DS and the EJB.jar is started.

               

              I'm don't know whether there is an option to force that the DS check the DB-connection periodicaly

              • 4. jboss enterprise application startup when DB is down
                oourfali

                I tried to "touch" the -ds file, but nothing happend.

                 

                The application is using JDBC to connect to the database, not through hibernate or something.

                Is it supposed to work when using JDBC?

                 

                What needs to be configured in order for it to work?

                • 5. jboss enterprise application startup when DB is down
                  wdfink

                  Do you use plain JDBC with EJB or WEB application?

                  To restart the application the dependency must be set correct. In my case the dependency is set because the jar file with the EJB2-CMP beans contains a dependency entry within the deployment descriptor.

                   

                  You must set such in your application, then the EAR/WAR will not deployed as long as the *-ds is not ready and in case of restart DS the application is also redeployed.

                  1 of 1 people found this helpful
                  • 6. jboss enterprise application startup when DB is down
                    oourfali

                    I'm new in my company so still learning how everything works.

                     

                    I'll check it out and see what's the right configuration.

                     

                    thank you again for your help.