4 Replies Latest reply on Apr 27, 2005 10:57 AM by studenik

    Can JBoss wait until the database becomes available?

    studenik

      Scenario:
      Computers where JBoss AS and the database get restarted. ?omputer with JBoss starts up first and finds no database because the computer with database has not fully started yet. JBoss displays the message:

      15:48:45,421 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null

      As a result application fails to deploy. Solution: restart JBoss manually after the database has fully restarted.

      Question:
      Is there a way to configure JBoss so that it attempts to connect to the database for some time before giving up and displaying the warning? Could there be any other workaround?

      Thanks,

      Yevgeny.

        • 1. Re: Can JBoss wait until the database becomes available?
          java_jboss

          I have the same problem, please if anyone found a solution, share it...

          • 2. Re: Can JBoss wait until the database becomes available?
            glum

            You can put your database outside jboss auto-deploy path, write simple application which will monitor database availability and deploy / undeploy your application as necessairy. Monitoring application can be e.g. simple servlet and delploy/undeploy your app using JBoss Deployer MBean operations.
            Maybe there is a better solution which I am not aware off. But I am sure this one would work.

            • 3. Re: Can JBoss wait until the database becomes available?
              studenik

              glum,

              Thank you for your suggestion. Probably your workaround should work. But I was wondering if there is a configurable parameter that would tell the deployer not to give up right away and continue to ping the database until it becomes available.

              Thanks,

              Yevgeny.

              • 4. Re: Can JBoss wait until the database becomes available?
                studenik

                I found that the connection pool configuration in WebLogic has an attribute 'Connection Creation Retry Frequency'. If it is greater than 0 and if the database is unavailable when the connection pool is created, WebLogic will attempt to create connections in the pool again after the number of seconds you specify, and will continue to attempt to create the connections until it succeeds.

                This sounds exactly what I am looking for. I wonder if a similar feature is available in JBoss?

                Thanks.