users@glassfish.java.net

Re: EJB Timer on cluster

From: Dies Koper <diesk_at_fast.au.fujitsu.com>
Date: Sat, 12 Dec 2009 12:57:54 +1100

Hi,

You would probably have had a warning in the server log when you started
the cluster that the EJB Timer Service could not start "because the
database was not running or the Timer's table was not created in the
database"?

Assuming your DB is running and you did create the 'EJB__TIMER__TBL'
table in that DB before you started the cluster, I can think of the
following other causes:

- JDBC resource is disabled.
   The JDBC resource's enabled state is kept in three locations:
globally, in your cluster, and in your cluster's instance. GF v2.x
however has a bug that even if one of these is disabled (which would
cause the JDBC resource to be unavailable), the Admin Console still
shows it as enabled. Especially if you disabled the resource during
resource creation time or created the resource in the 'server' first and
added the cluster to its targets later this bug makes it impossible to
enable it properly through the Admin Console. Open the domain.xml and
check that in the three settings with your JDBC resource (at the
beginning of the file (global), under your cluster-config's element and
your server instance's elements) they are all enabled. If not so, edit
the file and restart your DAS and clusters.
   There are also properties you can use with 'asadmin set' to enable
them, if you can find them.
   Note that Ping will work even if the resource is not enabled as Ping
works on the pool on the DAS, not on the JDBC resources.

- Database is not accessible.
   Double-check that you have all the settings right to make it search
for your DB and not the bundled JavaDB's:
   - Is your JDBC driver's libraries available to your cluster instances?
   - Does Ping work on your timer's pool?
   - Is jdbc/__TimerPool pointing to your pool, or as you have specified
another timer resource in cluster-config for the Timer Service, is that
pointing to your pool correctly?

Hope that helps,
Dies


glassfish_at_javadesktop.org wrote:
> Hello,
>
> I'm trying to use the timer service in a clustered application.
> I've used the following article to configure the timer service:
> http://programmaremobile.blogspot.com/2009/02/clustering-and-ejb-timer-eng.html
>
> I've used a postgresql database and created a XADataSource for the connection pool (org.postgresql.xa.PGXADataSource).
> Then I configured the ejb timer in the cluster config to use that datasource and restarted the node-agent and the domain.
>
> Then I start the timer using:
>
> [i]@Resource
> private SessionContext context;
>
> private void startNextTimer()
> {
> context.getTimerService().createTimer(10000, "NotificationTimer");
> }[/i]
>
> But then I got following exception:
> javax.ejb.EJBException: EJB Timer service not available
>
> But I can't find any log entry that says something about why the service is not available
> [Message sent by forum member 'dh2k7' ]
>
> http://forums.java.net/jive/thread.jspa?messageID=376105