users@glassfish.java.net

Re: Unit test EJB timers

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Wed, 05 May 2010 09:38:23 -0700

EJB Timers are not supported on v3.0, but they should be working on the
latest trunk build if you use pre-installed GlassFish for your setup.

Regards,
-marina

glassfish_at_javadesktop.org wrote:
> I'm trying to unit test EJB's relying on timers using the embedded EJB container. The timeouts don't seem to be dispatched. Everything works fine using the regular GlassFish though.
>
> Anybody has an idea how to enable the timer service ?
>
> The nudge() method is not called in the embedded EJB container. Trying to inject the TimerService throws a colorful stacktrace which ends with:
>
> Caused by: java.lang.IllegalStateException: EJB Timer Service not available
> at com.sun.ejb.EjbNamingReferenceManagerImpl.getEJBContextObject(EjbNamingReferenceManagerImpl.java:227)
> at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbContextProxy.create(ComponentEnvManagerImpl.java:854)
> at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:688)
> at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:657)
> at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:148)
> ... 43 more
>
> =============
> Creating the container
> =============
> ...
> EJBContainer ejbContainer = EJBContainer.createEJBContainer();
> ...
>
> =====
> The EJB
> =====
>
> @Singleton
> @Startup
> public class HelloBean implements Hello {
> @Resource
> private TimerService timerService;
>
> @Schedule(second = "*/5", minute = "*", hour = "*",persistent=false)
> private void nudge() {
> System.out.println( "Wakig up ... " );
> }
> }
> [Message sent by forum member 'jan_goyvaerts']
>
> http://forums.java.net/jive/thread.jspa?messageID=406800
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>