You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bill Faulk <bi...@cis.com> on 2004/02/10 20:56:41 UTC

Starting tomcat when the DB is down

Hi Folks,

I am using SQL Server 2000 via the JDBC realm with forms authentication.
If the database is down when tomcat starts there is an unhandled
LifecycleException generated and tomcat quits. I have the code in place
in my login.jsp to generate a "please try again later" style message (or
whatever other message I choose) if the database goes down after Tomcat
starts. However, I want to avoid a "Cannot find server" error if the
database isn't up.

If there's a problem with the database I want the alternative to just
having the site be down because Tomcat won't start. Not all of the site
is actually part of the protected content and I want the unprotected
content still available if the DB is down.

Is there supposed to be any way to allow tomcat to start even with an
unreachable database configured? If this is the expected behavior and is
unavoidable then I guess I'll just live with it. Hopefully it doesn't
happen enough to be an issue. :-)

Catalina.start: LifecycleException:  Exception opening database
connection:
  java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC]Error establishing socket.
LifecycleException:  Exception opening database connection:
java.sql.SQLException:
 [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
        at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:681)
        at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3
... snip ...
Stopping service salesweb
Catalina.stop: LifecycleException:  Coyote connector has not been
started
LifecycleException:  Coyote connector has not been started
        at
org.apache.coyote.tomcat4.CoyoteConnector.stop(CoyoteConnector.java:1
... snip ...

---
Bill Faulk

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Starting tomcat when the DB is down

Posted by Tim Funk <fu...@joedog.org>.
Which version? I thought 4.1.30 was patched to allow tomcat to start up even 
if the database realm connect failed.

-Tim

Bill Faulk wrote:
> Hi Folks,
> 
> I am using SQL Server 2000 via the JDBC realm with forms authentication.
> If the database is down when tomcat starts there is an unhandled
> LifecycleException generated and tomcat quits. I have the code in place
> in my login.jsp to generate a "please try again later" style message (or
> whatever other message I choose) if the database goes down after Tomcat
> starts. However, I want to avoid a "Cannot find server" error if the
> database isn't up.
> 
> If there's a problem with the database I want the alternative to just
> having the site be down because Tomcat won't start. Not all of the site
> is actually part of the protected content and I want the unprotected
> content still available if the DB is down.
> 
> Is there supposed to be any way to allow tomcat to start even with an
> unreachable database configured? If this is the expected behavior and is
> unavoidable then I guess I'll just live with it. Hopefully it doesn't
> happen enough to be an issue. :-)
> 
> Catalina.start: LifecycleException:  Exception opening database
> connection:
>   java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
> JDBC]Error establishing socket.
> LifecycleException:  Exception opening database connection:
> java.sql.SQLException:
>  [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
>         at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:681)
>         at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:3
> ... snip ...
> Stopping service salesweb
> Catalina.stop: LifecycleException:  Coyote connector has not been
> started
> LifecycleException:  Coyote connector has not been started
>         at
> org.apache.coyote.tomcat4.CoyoteConnector.stop(CoyoteConnector.java:1
> ... snip ...
> 
> ---


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org