• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

GenericServlet.Init()

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic