File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Is servlet appropriate for reading a schedule file from a file system? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Is servlet appropriate for reading a schedule file from a file system?" Watch "Is servlet appropriate for reading a schedule file from a file system?" New topic
Author

Is servlet appropriate for reading a schedule file from a file system?

mike tran
Greenhorn

Joined: Jul 10, 2012
Posts: 8
Hello,

I was given a pretty routine task to read a xml file from a file system and update its content into the database.
I already had a jaxb program to read the object from xml file and update it to database. Since the xml file is put there on my machine at 8am each day, and I have to write
a schedule program to pick up the file. I have not work on schedule program before so I would like to seek your help. I am thinking about reusing my jaxb program. I wonder what is the best way to approach it? Could i write a scheduler program in eclipse , and how do I call that program at a certain time, let says 7:58 am in the morning?

Thanks again for all of your help,

Mike
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

A servlet? To run a scheduled job at the same time every day? No.

Just set up a cron job or a Windows scheduler job, depending on what operating system your file resides on.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61209
    
  66

It does not sound like a servlet is an appropriate technology for this. Servlets are used to respond to requests from a browser.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Quartz Job Scheduler
-just google and see whether it can help you.
Andreas Taber
Greenhorn

Joined: May 14, 2012
Posts: 5

I was faced with the same issue that you're facing a while ago. There are really no allowable ways of scheduling a process using a servlet since you should not be creating threads on your own. Therefore, it's advisable to use a cron job or a Window's service. Since I was using Windows, I elected to employ a java based Window's service. What a mistake as it was extremely fidgety to say the least. Fortunately, I know C# rather well having taught it many times over the years so I created my Window's service using that language.


IT Training Manager with the Hartmann Software Group
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is servlet appropriate for reading a schedule file from a file system?