I would like to know when the ServletContextListener.contextCreated() function is called when Tomcat starts ? or is it possible to call this function only on the first request? In fact when the first request arrives to Tomcat I have to open an application session on our application server to get business data. This application session is the same for all the clients. But the creation of this session is transparent for the clients, I cannot ask him to go to see in the files of Tomcat's log. That's why if an error occurs at the application session creation, on the first action of the client I would like to display an error. Because if the application session is not created the client can nothing make.
If I understood the various remarks well, there are several ways of making: - Place code in the ServletContextListener.contextCreated() and use Token objects to indicate an error; But we decide to start Tomcat as Windows service but not our application server. So I can use this method only if this method is called on the first request and not on the Tomcat startup. - Override the init() method of the TilesRequestProcessor class; I try this but the debug doesn't enter in the overridden method; - Use Filter; I am not informed any on this subject where can I find the best doc about filters; -----Original Message----- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: 06 February 2003 22:56 To: Struts Users Mailing List Subject: RE: Application Startup On Thu, 6 Feb 2003, Heligon Sandra wrote: > Date: Thu, 6 Feb 2003 15:01:44 +0100 > From: Heligon Sandra <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> > Subject: RE: Application Startup > > The problem with the ServletContextListener is that we can not > display error to the client if an error occur, isn'it ? > If you're doing things at application startup, there *are* no users yet. A ServletContextListener.contextCreated() method that detects an error should write messages to the appropriate log file to describe what happened (for example, you could call ServletContext.log() for this), plus throw an exception back to the container. That will cause the container to not put the application into service, because something was wrong at startup time. In a Servlet 2.2 environment, you'd do exactly the same sort of thing, but in t he init() method of a servlet marked for <load-on-startup> instead. In either case, the initialization will have been completed by the container before the application is allowed to start processing requests. Craig --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

