Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

event alert

 
santhoshkumar samala
Ranch Hand
Posts: 156
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 156
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 156
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic