Thanks for your explanation, in fact the web application has to connect
to a back-end application server that centralizes data, access right etc...
The connection must be initialised only one time that is why I have placed
this code in ServletContextListener.
But if the application server is not start or an other communication
problem occurs the web application can not be started.

According to your councils I recorded the messages of the exceptions in a
file.  
(getServletContext().log("message", exception)).
But I do not know where this log is created.  
I use Tomcat4.0.3 and no directory log is created.  

In spite of this exception the index.jsp page is displayed.  
A page HTML Server ERROR should rather be displayed.  
How can I do that ?

-----Original Message-----
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]]
Sent: 03 October 2002 17:00
To: Tomcat Users List
Subject: RE: Exception management in servlet listeners


Hi,

>I use the new feature ServletContextListener of the Servlet
specifications
>2.3.

Great!  So do I. ;)

>I don't what to do when the exception ExBadManagerName occurs. I am
trying

Log it, for one.  Even if you don't have a logging system initialized,
you can use getServletContext().log("message", exception).  Email the
admins, for two.  

>to define in the web.xml file of my application the following element
><error-page>
>       <exception-type>com.mycompagny.ExBadManagerName
</exception-type>
>       <location>/pages/errorPage.jsp</location>
></error-page>
>but the page is not displayed.
>What can I do to inform the client if an exception occurs, the
index.jsp
>page of my application has not to be displayed.

When you're in the contextInitialized(sce) method, you don't have a
"client" yet.  You're not tied into the connector, and so the error-page
tags don't mean a thing.  

The idea is that the stuff done in contextInitialized(), and for that
matter, contextDestroyed(), is administrative / configuration
functionality that should not involve your users directly.  That code
should be very carefully written and tested, and should be among the
most reliable code in your system.  And your server startup and shutdown
should be tightly regulated and monitored.  You don't want your users
(think malicious...) to know how / when / where you initialize and
shutdown things.

I hope that makes sense ;)

Yoav Shapira
Millennium ChemInformatics

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to