I have a singleton servlet which i want to load on startup of tomcat server. I have added 'load-on-startup' tag with a random value(23) in web.xml file of the application which contains this servlet. I have some system.out.printlns in this servlet which print out something when the servlet has been loaded(and I can confirm that the servlet has been genuinely loaded. I cant see these System.out.println s! But when the servlet is explicitly called, i can see the system.out.printlns, suggesting that the servlet was not loaded when tomcat started. Am I missing something? How do I see those system.out.printlns at startup
nirmal baba
Greenhorn
Joined: Apr 06, 2001
Posts: 10
posted
0
Loading a servlet involves three things-class loading from deployment archive+instantiation+initialization!!....In ur case even though the servlet is getting instantiated and loaded at startup ,it is not showing the System.out.println statements probably because u have put them in the service()/doGet()/doPost() method of ur servlet!! That's why they r showing up when one of these methods is invoked as a part of request processing. They will appear at startup time only if u keep them in the init() method...Kindly try and confirm Good Luck Nirmal
Sachin Deshpande
Greenhorn
Joined: Jan 31, 2001
Posts: 25
posted
0
yes the system.out.printlns were there in the service method putting them in init worked thanx