Thursday 13 October 2011

Glassfish, clusters and ejbtimers

After days lost to this feature, I thought I'd write a quick how-to guide on getting the ejbtimer app to behave on a cluster with UCP enabled in the database (so we have a solution which enables FCF to work).

(i.e. setting the resource type to javax.sql.XADataSource and the driver implementation to the oracle.ucp.jdbc.PoolXADataSourceImpl)

The Problem
When publishing an application to the glassfish cluster, I'd get lots of EOFException on a node of the cluster. Some nodes would start, others would not and have this EOFException thrown when trying to read EJB__TIMER__TBL.BLOB. Looked like a race condition on startup yo me... so back to my app to figure out what I was doing wrong....

The Solution
Turned out, nothing! It was all because I was being too cautious on exposing the ejbtimer resources only to the cluster. Basically I was only letting the node see the EJBTimer resource I had setup  pointing to an oracle database. It turns out that when I allowed the DAS to see the same resource, all behaved itself. I guess the DAS must get envolved on startup of the ejb-timer-service... who would have thought!