You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Raghavendra Datt <ra...@gmail.com> on 2008/08/13 20:32:50 UTC

Default error page generation logic in tomcat

Hi Guys,
  I had a specific requirement related to tomcat error generation. When a
default error page is generated like 404 error page, tomcat appends its
version info at the bottom of the page. I don't want this version to be
displayed on the error page. I am trying to understand which part of the
tomcat code actually does this?

Any response will be appreciated.

Thanks,
Raghu

Re: Default error page generation logic in tomcat

Posted by Raghavendra Datt <ra...@gmail.com>.
Ok... I just figured out a work around for this to make work. I modified
ServerInfo.properties from catalina.jar and re-jarred it and  overrode the
original catalina.jar. This seems to work. but, I am just curious whether
this has any side effects? Earlier, I tried doing the same thing but, was
not actually overriding catalina.jar proprely.

Thanks,
Raghu

On Wed, Aug 13, 2008 at 1:02 PM, Caldarale, Charles R <
Chuck.Caldarale@unisys.com> wrote:

> > From: Raghavendra Datt [mailto:raghavendradatt@gmail.com]
> > Subject: Re: Default error page generation logic in tomcat
> >
> > I have this tomcat running on linux and I don't find
> > catalina.properties any where in the tomcat folders.
>
> A red flag just went up.  Are you using a real Tomcat, or a 3rd-party
> repackaged version?  If the latter, it probably has scattered Tomcat files
> all over the place, and will be prone to numerous errors and stability
> issues.  Suggest removing the Tomcat you have and downloading a real one
> from http://tomcat.apache.org.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
> ---------------------------------------------------------------------
> 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: Default error page generation logic in tomcat

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Raghavendra Datt [mailto:raghavendradatt@gmail.com]
> Subject: Re: Default error page generation logic in tomcat
>
> I have this tomcat running on linux and I don't find
> catalina.properties any where in the tomcat folders.

A red flag just went up.  Are you using a real Tomcat, or a 3rd-party repackaged version?  If the latter, it probably has scattered Tomcat files all over the place, and will be prone to numerous errors and stability issues.  Suggest removing the Tomcat you have and downloading a real one from http://tomcat.apache.org.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
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: Default error page generation logic in tomcat

Posted by Raghavendra Datt <ra...@gmail.com>.
Mark,
  Appreciate your response. I have this tomcat running on linux and I don't
find catalina.properties any where in the tomcat folders. so, I tried
unzipping this catalina.jar and changed the ServerInfo.Properties and zipped
into catalina.jar. but, still I see that version info on an error.

Do you know whether catalina.properties and catalina.policy ( which I could
find in my linux) or same?
Unzipping, modifying and zipping back - should this solve the problem?

Thanks,
Raghu

On Wed, Aug 13, 2008 at 12:05 PM, Mark Thomas <ma...@apache.org> wrote:

> Raghavendra Datt wrote:
>
>> Hi Guys,
>>  I had a specific requirement related to tomcat error generation. When a
>> default error page is generated like 404 error page, tomcat appends its
>> version info at the bottom of the page. I don't want this version to be
>> displayed on the error page. I am trying to understand which part of the
>> tomcat code actually does this?
>>
>
> It is the ErrorReportValve and it gets the information from
> org.apache.catalina.util.ServerInfo
>
> You can over-ride this by:
>
> 1. extract org/apache/catalina/util/ServerInfo.properties from catalina.jar
> and put that file in
> ${CATALINA_HOME}/classes/org/apache/catalina/util/ServerInfo.properties
>
> 2. Edit ${CATALINA_HOME}/conf/catalina.properties and change
> common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar
> to
>
> common.loader=${catalina.home}/classes,${catalina.home}/lib,${catalina.home}/lib/*.jar
>
> Any values you put in
> ${CATALINA_HOME}/classes/org/apache/catalina/util/ServerInfo.properties will
> be used when reporting server name, version etc.
>
> HTH,
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> 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: Default error page generation logic in tomcat

Posted by Mark Thomas <ma...@apache.org>.
Raghavendra Datt wrote:
> Hi Guys,
>   I had a specific requirement related to tomcat error generation. When a
> default error page is generated like 404 error page, tomcat appends its
> version info at the bottom of the page. I don't want this version to be
> displayed on the error page. I am trying to understand which part of the
> tomcat code actually does this?

It is the ErrorReportValve and it gets the information from 
org.apache.catalina.util.ServerInfo

You can over-ride this by:

1. extract org/apache/catalina/util/ServerInfo.properties from catalina.jar 
and put that file in 
${CATALINA_HOME}/classes/org/apache/catalina/util/ServerInfo.properties

2. Edit ${CATALINA_HOME}/conf/catalina.properties and change
common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar
to
common.loader=${catalina.home}/classes,${catalina.home}/lib,${catalina.home}/lib/*.jar

Any values you put in 
${CATALINA_HOME}/classes/org/apache/catalina/util/ServerInfo.properties 
will be used when reporting server name, version etc.

HTH,

Mark



---------------------------------------------------------------------
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: Default error page generation logic in tomcat

Posted by Angus Mezick <am...@lumberliquidators.com>.
Create your own 404 error page and add it to your web.xml.
<error-page>
<error-code>404</error-code>
<location>/error/404.jsp</location>
</error-page>
−
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error/500.jsp</location>
</error-page>
−
<error-page>
<error-code>500</error-code>
<location>/error/500.jsp</location>
</error-page>

--Angus Mezick

-----Original Message-----
From: Raghavendra Datt [mailto:raghavendradatt@gmail.com] 
Sent: Wednesday, August 13, 2008 2:33 PM
To: users@tomcat.apache.org
Subject: Default error page generation logic in tomcat

Hi Guys,
  I had a specific requirement related to tomcat error generation. When a
default error page is generated like 404 error page, tomcat appends its
version info at the bottom of the page. I don't want this version to be
displayed on the error page. I am trying to understand which part of the
tomcat code actually does this?

Any response will be appreciated.

Thanks,
Raghu