0

I have created a stand alone jar which does some job. The job has to be run at scheduled time regularly. I can invoke the jar using windows schedular. But I want to know if I can use tomcat or IBM web sphere server to invoke the jar at scheduled times.

Of course I can create a war file and deploy it in server but that is not what I am looking for.

Thanks in Advance

Anveshan
  • 614
  • 1
  • 9
  • 21

2 Answers2

0

Many ways but WAS specific asked so will suggest to use cron job feature.

Go to WAS Console > Resources > Schedulers. To implement a CRON like calendar set the UserCalendar on the TaskInfo object, sample:

taskInfo.setUserCalendar(null, "CRON");
taskInfo.setStartTimeInterval("* 10 * * ?")

Read more here in docs.

Sheetal Mohan Sharma
  • 2,908
  • 1
  • 23
  • 24
  • Thank you for your reply Sheetal. When I went through the link, I have found that only on J2EE applications, the default scheduler calendars will work. However what I want is, I have independent jar file and I want to invoke that jar from IBM web sphere. .. – Anveshan Mar 14 '16 at 12:29
  • Write a shell script..simple? – Sheetal Mohan Sharma Mar 14 '16 at 14:39
0

I am not aware if tomcat/websphere provides explicit support to handle your issue. Since you have mentioned multiple app servers, I suggest to go for simple java's timer packaged inside your jar, an example listed here

This approach will give you app server independence as well as OS independence. You can for cron4J or quartz if your requirements grow.

Amit Parashar
  • 1,447
  • 12
  • 15