All of the major Tomcat components implement org.apache.catalina.Lifecycle
which includes the ability to add a org.apache.catalina.LifecycleListener
. It sounds like you want the AFTER_START_EVENT
of the Host
.
You configure the listener in server.xml like this:
<Host ... >
<Listener className="your.package.KPTomcatListener"/>
<!-- Other nested elements go here -->
</Host>
The class must be packaged in a JAR and the JAR placed in Tomcat's lib directory.