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

@Timeout method not called

 
nikola petanjak
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone.

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 7.0.0.11.

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 7.0.0.9).

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.

The overall code is rather simple:

ContextListener:



EJB timer:



EJB timer interface:



Thank you all in advance.

Nikola
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nikola petanjak wrote:



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?

 
nikola petanjak
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jaikiran, and thanks for your reply.

Yes i printed cal.getTime(), the date and time are as it should be. The problem is very similar, it seems to me, to this one:

http://www-01.ibm.com/support/docview.wss?uid=swg21388449

so i hoped newer fix pack will solve it, but then i realized that my version is 7.0.0.9, and they
recommend upgrading to 7.0.0.3...
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nikola petanjak wrote:

Yes i printed cal.getTime(), the date and time are as it should be. The problem is very similar, it seems to me, to this one:

http://www-01.ibm.com/support/docview.wss?uid=swg21388449


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?
 
nikola petanjak
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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 7.0.0.21 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.





 
nikola petanjak
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

unfortunately i was forced to find another solution for automatic calling EJB method. I done it via WAS 7.0 Scheduler.

Short tutorial is on this link:

Calling EJB bean with WAS 7.0 Scheduler
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic