File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes How to add a class to Tomcat-5.5 startup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to add a class to Tomcat-5.5 startup" Watch "How to add a class to Tomcat-5.5 startup" New topic
Author

How to add a class to Tomcat-5.5 startup

Jai Muthunalla
Greenhorn

Joined: Jan 01, 2008
Posts: 11
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.


SCJP(1.4)
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

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

Joined: Jan 01, 2008
Posts: 11
Thanks for the lead Marco...I'll give it a try
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

Good luck with it

By the way, under Linux Tomcat itself is using the UNIX variant of Commons Daemon, "jsvc".
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to add a class to Tomcat-5.5 startup