Question

I wonder if you could help me with this:

At first sorry if I am asking something easy, but I am amateur in this.

I have a tomcat server in my computer and I have several services (programmed in java language with Eclipse) in it. What I would like to know is if it is possible to stablish a code that should be execute in each service when Tomcat server turns on or reset. If it is possible, how could I do that?

Was it helpful?

Solution

A ServletContextListener is meant for exactly this type of thing. Your implementation of contextInitialized() will be called when the server starts the "context" (meaning the webapp).

OTHER TIPS

You can create a Context Creation listener.(ServletContextListener)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top