wood burning stoves*
The moose likes Tomcat and the fly likes event alert Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "event alert" Watch "event alert" New topic
Author

event alert

santhoshkumar samala
Ranch Hand

Joined: Nov 12, 2003
Posts: 156

we have a got small problem in tomcat
if any application has to be run continuosly run in the server then the application should be plcaed in which directory/path of tomcat.Here the application is simple java program.
for example:
I have an application which sends the birthday wishes mail to the users
The users are registred with me . So i will write a java program such that
it will automatically send the mail to the user by comparing the present date and their birthday
This application should be continously(24/7) run in server and whenver it finds date matches it should execute that java file
I wrote the java program but where we should place this java file in the server path .Im using tomcat 4.0
any body please help


santhosh<br />SCJP,SCWCD
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Exactly what is the connection between Tomcat and this birthday server anyway? If you wrote it as an application with a main() method, it can run anywhere. If you just want to have it running in the Tomcat JVM, you will have to give it a servlet wrapper, a web.xml entry, and treat it like a servlet that gets loaded on startup.
If this was my problem I would have the servlet wrapper capable of reporting statistics from the birthday server - makes it easy to check up on it.
Bill
santhoshkumar samala
Ranch Hand

Joined: Nov 12, 2003
Posts: 156

thanks mrBrogden,
my birthday server is nothing but this tomcat,
can you please provide sample code for writing this servlet and place in web.xml
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
can you please provide sample code for writing this servlet and place in web.xml

No - I charge $ for this sort of thing.
I am sure you can do it yourself if you proceed methodically.
Look at the use of the <load-on-startup>1</load-on-startup> element in web.xml to see how to be sure a servlet is always loaded when the server starts. Use the init method of that servlet to create an instance variable of your birthday server. Use the doGet or doPost method of that servlet to report the status of the birthday server.
Bill
santhoshkumar samala
Ranch Hand

Joined: Nov 12, 2003
Posts: 156

thank u william for your answer
I got the tag but can u give the code of sample servelet and where should the class file of the servlet placed?
 
wood burning stoves
 
subject: event alert