How to use @PostConstruct to create timers in a stateless bean EJB3?

I'm not 100% sure but I think that the bean class must implement javax.ejb. TimedObject or have a method annotated with Timeout to use EJB timers. Example.

I'm not 100% sure but I think that the bean class must implement javax.ejb. TimedObject or have a method annotated with @Timeout to use EJB timers. Example: @Stateless public class TestBean implements TestLocal { @Resource TimerService timerService; @PostConstruct public void startTimer() { if (timerService.getTimers().size() == 0) { timerService.

CreateTimer(1 * 1000, 1 * 1000, null); } } @Timeout @TransactionAttribute(value=REQUIRES_NEW) public void timeoutCallback(Timer timer) { ... } } Does WebLogic still complain with the above code? PS: In any case, the error you currently get is very poorly reported, you should probably open a case.

I follow your example, making 2 changes: a) TestLocal has a method to be implemented by TestBean (without this, weblogic can't deploy) b) a create a servlet that calls the EJB. The error still happens. – Topera Aug 18 '10 at 1:06 @Topera I was really not sure (I'm not even sure that what I suggested is mandatory with EJB 3.0).

I may be wrong but this looks like a bug. I suggest contacting the support – Pascal Thivent Aug 19 '10 at 21:21 Well.... this is the only answer that I have....+1 and accepted! :) – Topera Aug 20 '10 at 12:57 1 Indeed, this code won't run, as Mike said.

Timers can't be accessed or started from a @Postconstruct method. – mikek Jun 17 at 12:19.

You can NOT use a @PostConstruct to create a timer in a stateless bean EJB 3. See this blog How to use EJB 3 timer in a weblogic 10 cluster environment for the explanation. Even the blog was talking about weblogic, but the explanation should apply to other app servers also.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions