wood burning stoves 2.0*
The moose likes Servlets and the fly likes web.xml autorun Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "web.xml autorun" Watch "web.xml autorun" New topic

web.xml autorun

Ryan Bailey
Ranch Hand

Joined: Feb 26, 2002
Posts: 134
Does anyone know how to have tomcat auto start a servlet once the tomcat service is started.
I found that if I include
for my servlet in my xml that would work. But I have also read that this can cause complications.
Ok here is my web.xml file

I was told the lower the number takes precedence in <load-on-startup>
My code is as follows

Neither one of my sys.out statements are being called.
Any suggestions? I would like to make a timed thread execute once tomcat is started. I am using tomcat 4.1
Thanks in advance for your time,

Java: The power, elegance, and simplicity of a hand grenade
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
<load-on-startup> work fine by me.
to make servlet be initialized first you should put the value of 1 , not -1.
try it.

Asher Tarnopolski
Ryan Bailey
Ranch Hand

Joined: Feb 26, 2002
Posts: 134
Someone please help!!
I have double checked my code and web.xml file and I still do not understand why I am not seeing an output of hello once I start the servlet engine. I thought maybe it was a configuration at work, but I tried testing this case at home and I'm still having the same issue. If anyone could lead me into the right direction it would be very appriciated.
Thank you,
Ryan Bailey
Ranch Hand

Joined: Feb 26, 2002
Posts: 134
I figured it out. Who ever told me that negative numbers took precedence over positive number it full of you know what. I changed my negative number to a positive number and it worked just fine. Sorry for sounding so desperate but I was really starting to not understand why this wasn't working.
I agree. Here's the link: http://aspose.com/file-tools
subject: web.xml autorun
Similar Threads
Tomcat autorun
help with servlet initialization
context parameter
Servlet instance is started twice
Tomcat Startup and Shutdown