In that case, you want a LifecycleListener
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/LifecycleListener.html)
looking for the AFTER_START event.  You can then write code in the
listener to do something unambiguous when the event triggers - I'd
write a file somewhere, but I'm old-fashioned like that.

Configuration is performed by adding a Listener element to your
server.xml - see
http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html for some
of the docs, though I'm not aware of a tutorial anywhere that shows
how to implement and add one.  You'll want to nest yours inside the
Server element, I think.

- Peter

On 11 February 2010 12:15, Jan Van Besien <janvanbes...@gmail.com> wrote:
> Pid wrote:
>>
>> On 11/02/2010 11:15, Jan Van Besien wrote:
>>>
>>> Hi all,
>>>
>>> I'm using tomcat-6.0.18 with java-1.6.0-18 on ubuntu-9.10.
>>>
>>> We are using the tanuki service wrapper to run tomcat as a linux
>>> service, more or less as described in [1].
>>>
>>> We also have a monitoring mechanism which checks the "health" of the
>>> running tomcat with all the applications deployed into it by making
>>> certain well choosen http requests that test some core functionality of
>>> our applications. If some of this fails, a system is in place to have
>>> another redundant server (with another tomcat) take over.
>>>
>>> Now the problem is that we only want the monitoring mechanism to start
>>> monitoring after tomcat is completely started (successful or not). So I
>>> would like to know what my options are to "ask" a running tomcat if it
>>> has more startup/deployment work to do, or if it is finished.
>>>
>>> The log files contain things like "INFO: Server startup in 39188 ms", so
>>> clearly tomcat knows this information. I could ofcourse parse the log
>>> files, but I would prefer a more robust mechanism. Maybe a java API, or
>>> JMX or something like that?
>>
>> How do you define "completely started"?  E.g. The server might start but
>> the applications not start.
>
> I agree this is a subtile question, but whatever makes tomcat decide to log
> "Server startup in xxx ms" is good for me. Note that it also logs this if
> one of the deployments failed.
>
>> Apart from JMX, there a number of things you can do within the server and
>> each application that could lead to a notification.  Implement a
>> ServletContextListener for an application, or a LifecycleListener for the
>> server.
>
> I don't want anything in my applications per se, because when tomcat fails
> to deploy one of my applications (for whatever reason), I still want to know
> that tomcat is finished "trying" to deploy my applications.
>
> Kind regards
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to