In an EJB3 application I have a EJB3-style timer that get's started by a ServletContextListener at deployment time.
In the Listener I call getTimerService() on an injected EJBContext.
On the resulting TimerService I call getTimers() to check whether an instance of that timer already exists and if not I register a new one via createTimer().
That works like a charm. When the timer was created during a previous deployment, it is correctly listed by getTimers() and I can react on that.
Now I was trying to add to the application a standard MBean that could be used to reschedule and/or cancel that timer.
In one of the MBeans business methods I do exactly as before: call getTimerService() on the injected EJBContext.
The problem is that the TimerService thusly returned does not seem to know about the timers registered earlier: it's getTimers() returns an empty Collection even though there are timers registered.
Am I doing something wrong here?
Thanks in advance,