aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes @Timeout method not called Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "@Timeout method not called" Watch "@Timeout method not called" New topic
Author

@Timeout method not called

nikola petanjak
Greenhorn

Joined: Apr 01, 2011
Posts: 19
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

Joined: Jul 20, 2005
Posts: 10288
    
169

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?


[My Blog] [JavaRanch Journal]
nikola petanjak
Greenhorn

Joined: Apr 01, 2011
Posts: 19
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

Joined: Jul 20, 2005
Posts: 10288
    
169

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

Joined: Apr 01, 2011
Posts: 19
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

Joined: Apr 01, 2011
Posts: 19
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @Timeout method not called