You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Eric B." <eb...@hotmail.com> on 2006/07/24 20:23:10 UTC

Custom Error page when Tomcat is down?

Hi,

I've been scouring the docs & newsgroups for the last hour or so, and have 
been unable to find a solution to my problem.  Currently, I have tomcat 
being access through the Apache httpd server, configured via the jk_mod 
connector/module.

My problem is I have to sometimes stop the tomcat server for general 
maintenance.  When this happens, Apache will show an error page "The server 
encountered an internal error or misconfiguration and was unable to complete 
your request. ....", because the jkWorker is no longer able to access the 
Tomcat server.

Is there any way I can customize that error page to say/show something 
different?

My workers file is pretty simple:
JkWorkerProperty worker.host=localhost
JkWorkerProperty worker.type=ajp13
JkWorkerProperty worker.list=jkWorker1
JkWorkerProperty worker.jkWorker1=8010


Then the httpd.conf file has the following:
<VirtualHost *:80>
   ServerName www.mydomain.com
   DocumentRoot "/var/www/html"
   JkMount /test/* jkWorker1
</VirtualHost>


So if I ever try to access www.mydomain.com/test when tomcat is down, I get 
that general "server encountered internal error" error page.  Is there 
anything I can do to avoid that?

If anyone can point me in the right direction, I'd really appreciate it.

Thanks!

Eric




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Custom Error page when Tomcat is down?

Posted by Hassan Schroeder <ha...@gmail.com>.
On 7/24/06, Eric B. <eb...@hotmail.com> wrote:

> > If Apache is generating an "internal server error" as you indicated, it
> > should be returning a 5xx status, I'd think.
>
> I'd think so too.  But I put in ErrorDocument 500 directives, and got
> nothing out of it.

OK, simplest test: I took a standalone Apache 2.0.52, put a text-string

  ErrorDocument 500 "Stimpy, you eediot"

into httpd.conf, forced a server error with a CGI script, and got my
test string returned with status  500.

So I would try to get that configured properly first, outside of your
mod_jk stuff, and go on from there.
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Custom Error page when Tomcat is down?

Posted by "Eric B." <eb...@hotmail.com>.
"Hassan Schroeder" <ha...@gmail.com> wrote in message
> On 7/24/06, Eric B. <eb...@hotmail.com> wrote:
>
>> Thanks for the pointer, but the problem that I see is that Apache is
>> returning the status code 200 to the browser.
>
> If Apache is generating an "internal server error" as you indicated, it
> should be returning a 5xx status, I'd think.
>

I'd think so too.  But I put in ErrorDocument 500 directives, and got 
nothing out of it.
In fact, I even went one step further and put in ErrorDocument directives 
for error codes 500-510 (just in case I was missing something) and none made 
a difference.  I tried putting them in the main body of the httpd.conf file 
(to ensure I wasn't having problems with VirtualHosts, etc), but still 
nothing.

ErrorDocument 500 "Site down 500"
ErrorDocument 501 "Site down 501"
ErrorDocument 502 "Site down 503"
ErrorDocument 503 "Site down 504"
ErrorDocument 504 "Site down 504"
ErrorDocument 505 "Site down 505"
ErrorDocument 506 "Site down 506"
ErrorDocument 507 "Site down 507"
ErrorDocument 508 "Site down 508"
ErrorDocument 509 "Site down 509"
ErrorDocument 510 "Site down 510"

ErrorDocument 404 "Site down 404"


The only one that seemed to make a difference was ErrorDocument 404 (when 
tested againsta a non-tomcat path).

Am I doing something wrong here?

Thanks,

Eric 




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Custom Error page when Tomcat is down?

Posted by Hassan Schroeder <ha...@gmail.com>.
On 7/24/06, Eric B. <eb...@hotmail.com> wrote:

> Thanks for the pointer, but the problem that I see is that Apache is
> returning the status code 200 to the browser.

If Apache is generating an "internal server error" as you indicated, it
should be returning a 5xx status, I'd think.

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Custom Error page when Tomcat is down?

Posted by "Eric B." <eb...@hotmail.com>.
"Hassan Schroeder" <ha...@gmail.com> wrote in message
>
>> Is there any way I can customize that error page to say/show something
>> different?
>
> See the Apache doc for "ErrorDocument"


Thanks for the pointer, but the problem that I see is that Apache is 
returning the status code 200 to the browser.  Obviously I can't put an 
ErrorDOcument directive on status 200, or none of the pages would work. 
Should I be looking at some other status code instead?

Thanks,

Eric 




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Custom Error page when Tomcat is down?

Posted by Hassan Schroeder <ha...@gmail.com>.
On 7/24/06, Eric B. <eb...@hotmail.com> wrote:

> Is there any way I can customize that error page to say/show something
> different?

See the Apache doc for "ErrorDocument"

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Custom Error page when Tomcat is down?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Eric,

> I've been scouring the docs & newsgroups for the last hour or so, and have 
> been unable to find a solution to my problem.  Currently, I have tomcat 
> being access through the Apache httpd server, configured via the jk_mod 
> connector/module.

I have the same setup, and just use "ErrorDocument 500" for a particular
URL space and send the user to the "down" page, like this:

        <Location "/yourWebapp">
                ErrorDocument 403 forbidden.html
                ErrorDocument 404 not_found.html
                ErrorDocument 500 down.html

                # This one means 'servlet unavailable'
                ErrorDocument 503 down.html
        </Location>

Yes, Tomcat /can/ issue a "500" error code, but I have that caught in
Tomcat and the user is sent to an error page (and the status code
returned is 200, even for an error). In this case, Apache never
inadvertently sends a user to the "down" page when Tomcat /is/ running,
but encounters an error.

Hope that helps.

-chris