Using EJB Timers in GlassFish V3 TP2
By Marina Vatkina on May 05, 2008
In this blog I'll explain how you can enable and use EJB Timer support in GlassFish V3 TP2.
If you hadn't done so yet, read first Mahesh's blog about Installing EJB Container in GlassFish V3 and using EJB 3.1 in GlassFish V3 TP2.
1. Change pool-name for the JDBC resource named jdbc/__TimerPool to point to the same connection pool as the one you are using for the rest of your data. You can do this either by editing the domain.xml file (and restarting the server), or via AdminGUI console (http://localhost:8080/admin/).
2. Start the database (or make sure it is running).
3. Deploy EJB Timer application that is located under <your-installtion>/glassfish/modules/ejb/ejb-timer-service-app-10.0-tp-2-SNAPSHOT.war. The aplication has been set up to use JPA with the default JPA provider, and to create the table on the first access.
4. Test that the TimerService has been started by accessing the following URL: http://localhost:8080/ejb-timer-service-app/timer
If everything went right, you'll see this screen:
All EJB 3.0 Timer features are supported with the exception of injection of TimerService using @Resource annotation. You can lookup TimerService via java:comp/TimerService.