Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to add a class to Tomcat-5.5 startup

 
Jai Muthunalla
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing an Poller service(thread based class) which reads from a properties file & sets some LOG parameters of Java logging package.
This class would act like a Demon thread, polling in the background every few mintues.
I want this Poller class to be invoked/started on start-up of Tomcat web-server.
I DON'T want this to be part of any web application.

Can someone please let me know how do I achieve this?

Thanks in advance.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jai,

you could use Apache commons daemon. This can help you to run Java applications like UNIX daemons or Windows services. With this you could simply start your daemon from the startup script of Tomcat.

Marco
 
Jai Muthunalla
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the lead Marco...I'll give it a try
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good luck with it

By the way, under Linux Tomcat itself is using the UNIX variant of Commons Daemon, "jsvc".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic