Take the 2-minute tour ×

I want to load a class on tomcat startup which will actually initialize variables in other classes.

i have edited the appName/WEB-INF/web.xml as follows


and i have placed my servlet LoadConfiguration in /appName/WEB-INF/classes

how do i check whether the servlet is beig called or not ? because when i try to display the value from initialized class it returns null

share|improve this question
try keeping logs or System.out.println("Inside Constuctor") inside constructor and init() method start and end. check if you are getting the logs. –  Jayesh Jul 29 '13 at 6:29
add comment

3 Answers

This is the solution for Tomcat 7.0





<Manager pathname=""/>



share|improve this answer
add comment

The container should call your servlets init() method when the servlet is initialized. Implement/override that method and try writing something to the log from there.

share|improve this answer
add comment

There are two problems:

  1. The compiled class needs to go into a folder structure base on the package name. In your case a folder called Loader

  2. In order to call the servlet, you need to add a <ServletMapping> to your web.xml file

share|improve this answer
add comment

Your Answer


