I am using contextListener to set EJB timer when application starts. Then, @Timeout method should be executed every 24 hours. On application stop timers are canceled.
I'm working with EJB3.0 and WebSphere Application server 184.108.40.206.
On my developing environment everything works fine, but on test environment @Timeout method is not called altough timer IS set in contextListener. I have exactly nothing in my logs at the timeout (test environment is on 220.127.116.11).
Any suggestions what could be reason for this behaviour besides different versions? I checked differences between these two versions but i haven't noticed anything related to EJB timers.
Are you sure that the initial time that you created using that Calendar instance doesn't end up in the distant future, on the test environment? Have you tried printing out cal.getTime() to see what it is?
It doesn't look like the same issue that you are running into. That issue talks about a single event timer which fires only once, unlike in your case which is a recurring timer expected to fire at specified intervals. Moreover, that doesn't explain why it works on one system and not on the other. You'll have to find the differences in those 2 systems, like the exact application server version, exact Java vendor and version, the timezone on both these systems. Furthermore, can you post the output of cal.getTime() and new Date() from within that servlet code?
Joined: Apr 01, 2011
i can't access test environment that easy so i'll just have to wait couple of more days...But i can tell you that timer was set properly after application was deployed (here's the original log):
1st println is 1st line in contextInitialized method.
2nd println is after setting Calendar to next day in 3 A.M. in contextInitialized method.
3rd println is from EJB in method setNewTimer, when called from contextInitialized, after createTimer method.
I think i'll try to set interval to 5 minutes to see how it goes...And update to 18.104.22.168 as soon as possible.
Also, i get this XA exception every now and then in logs (on test env.)...maybe that could be reason for timer not working, who knows.
Joined: Apr 01, 2011
unfortunately i was forced to find another solution for automatic calling EJB method. I done it via WAS 7.0 Scheduler.