aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "web.xml autorun" Watch "web.xml autorun" New topic
Author

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
<load-on-startup>1</load-on-startup>
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,
Ryan


SCJP 1.4, SCWCD
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
SCJP,SCWCD
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
Ryan Bailey
Ranch Hand

Joined: Feb 26, 2002
Posts: 134
OK, NEVERMIND!!
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