aspose file tools*
The moose likes Servlets and the fly likes GenericServlet.Init() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "GenericServlet.Init()" Watch "GenericServlet.Init()" New topic
Author

GenericServlet.Init()

Ryan Bailey
Ranch Hand

Joined: Feb 26, 2002
Posts: 134
I am having some trouble using the init method. In my web.xml file I am setting load-on-startup to 1. So when I startup my servlet engine my servlet with the load-on-startup paramter will start up. This is working just fine. The init method gets called and starts executing the code in the body. However, I am calling another method of another class that simply prints out a message to the screen. This method does not seem to be getting called. It's like it just jumps right over the method call and continues to load the servlet engine. below is my code example that I'm executing.


Hi 1 is getting executing, but when calling the TemperatureTimer constructor, Hi 2 is not getting called. Why is this? I can't figure this out if my life depended on it.
I want to write a Servlet that gets instantiated automatically when the servlet engine starts. The TemperatureTimer does implement Runnable. I'm reading temperatures via iButtons, but can't seem to instantiate the darn TemperatureTimer class. I even had the TemperatureTimer class methods inside the servlet class. Still no methods were getting called. I'm sure it's something easy that I'm just overlooking.
Thanks in advance for you time,
Ryan


SCJP 1.4, SCWCD
Java: The power, elegance, and simplicity of a hand grenade
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12681
    
    5
The first thing I would do is enclose the call to the TemperatureTimer constructor in a try{}catch{} to see if the statement is throwing some exception such as class not found.
Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GenericServlet.Init()
 
Similar Threads
Load on startup
getServletConfig
TimerTask and Actions (Servlets)
Servlet instance is started twice
I do not understand servlet initalization