Discussions

Web tier: servlets, JSP, Web frameworks: how to run a batch program in webserver

  1. i am working in one project ,where we should run a batch program at everyday by giving some sheduling time,
    In the batch program(daily.jsp) will update some tables in the database, so i want to known how this batch program should run at webserver,here we are using weblogic or
    javawebserver,so please give me information about this and any alternative is there to run batch program.
  2. any good server should come with good documentation regarding running it as a batch process. As far as weblogic is concerned i am not sure about jsp's but i could give you some info about running a batch file to deploy ejbs. it is pretty simple in fact. after you have successfully written a bean and deployed it, add your bean to the weblogic.properties file located in the directory where weblogic is installed. the next time you start the server the beans are automatically deployed(provided they are bug-free:-)). i am sure the documentation will help regarding how to start the server as a bartch file
  3. If you are running Weblogic you have the possibility of using the TimeServices framework. Also, in JDK1.3 you can user the Timer class for scheduling work at a later timer.

    Neither of these, however, support persistence of scheduled jobs or happy living in a clustered environment. In cases where this is needed, consider rolling your own framework or have a look at a third-party product, Flux (www.simscomputing.com) for example.

    Another possibility is executing the batch wholly outside the app server, using a Unix cron job or any other batch tool.

    Also, why are you implementing you batch as a jsp page? It seems a bit convoluted to have to make a HTTP request in order to trigger the batch job, would it not be easier to bypass the HTTP layer and implement it as an EJB or standalone Java utility class?

    Regards,

    /Ola