tbond
tbond

Reputation: 205

how do i add a custom startup class to tomcat?

I need to tweak some things inside Tomcat 6.0 before any web applications or listeners are started. What's the standard method for doing this? I can't do this from a web application or servlet init() since it is too late by the time it is loaded.

Upvotes: 3

Views: 2244

Answers (2)

StaxMan
StaxMan

Reputation: 116572

You could run "embedded Tomcat", in which you fully control its setup, much like how Jetty is usually used.

Google pointed to following docs:

which seem to cover this in Tomcat 5.5, but should work with 6 as well.

Upvotes: 0

andri
andri

Reputation: 11292

Creating a custom LifecycleListener is probably the right way of doing this. See the Tomcat configuration guide for more details; the lifecycle listeners can be added to most containers.

Upvotes: 3

Related Questions