Skip to main content

Cannot Deploy Ear - EJB Timer Service Not Available

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
2 replies [Last post]
sdoca
Offline
Joined: 2010-04-22

Hi,

I have an ear that I've deployed to my Glassfish (3.1.1) domain multiple times sucessfully. The ear contains an ejb-jar and a bunch of lib jars. One of the lib jars has a class in it that has a method annotated with javax.ejb.Schedule. No changes have been made to this lib jar, but "suddenly" I'm having EJB timer issues deploying the ear.

Initially I got the message:

Error occurred during deployment: Exception while deploying the app [MyApp-ear-1.0] : Failed to create automatic timers for 
MyAnnotatedClass -- null. Please see server.log for more details.

The server log contained this:

[#|2011-12-13T15:07:32.088-0700|WARNING|glassfish3.1.1|org.eclipse.persistence.session.file:/opt/glassfishv3/glassfish/domains/domain1/applicati
ons/ejb-timer-service-app/WEB-INF/classes/___EJB__Timer__App|_ThreadID=19;_ThreadName=Thread-2;|
Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Table/View 'EJB__TIMER__TBL' does not exist.
Error Code: 30000
Call: SELECT COUNT("TIMERID") FROM "EJB__TIMER__TBL" WHERE ("APPLICATIONID" = ?)
        bind => [1 parameter bound]
Query: ReportQuery(name="countTimersByApplication" referenceClass=TimerState sql="SELECT COUNT("TIMERID") FROM "EJB__TIMER__TBL" WHERE ("APPLICATIONID" = ?)")
        at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
        at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644)
        at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
etc...

I found a StackOverFlow question that stated the "fix" was to copy the $GLASSFISH_HOME/glassfish/domains/domain1/lib/databases/ejbtimer from working instance of Glassfish. The server is a VM that was cloned so I went to the original to get its version of the ejbtimer files, but that directory doesn't exist on it. Then I stopped Glassfish, deleted the ejbtimer directory, restarted and tried to deploy again. The ejbtimer dir/files were recreated, but I still can't deploy the ear. Now I get this error:

<span class="label_sun4">Error occurred during deployment: Exception while shutting down application container : <br />java.lang.NullPointerException. Please see server.log for more details.</span>

I restarted Glassfish again, tried to deploy and still the same error. The server.log has this:

[#|2011-12-13T16:28:48.069-0700|WARNING|glassfish3.1.1|org.eclipse.persistence.session.file:/opt/glassfishv3/glassfish/domains/domain1/applications/ejb-timer-service-app/WEB-INF/classes/___EJB__Timer__App|_ThreadID=18;_ThreadName=Thread-2;|
Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Table/View 'EJB__TIMER__TBL' does not exist.
Error Code: 30000
Call: SELECT &quot;TIMERID&quot;, &quot;APPLICATIONID&quot;, &quot;BLOB&quot;, &quot;CONTAINERID&quot;, &quot;CREATIONTIMERAW&quot;, &quot;INITIALEXPIRATIONRAW&quot;, &quot;INTERVALDURATION&quot;, &quot;LASTEXPIRATIONRAW&quot;, &quot;OWNERID&quot;, &quot;PKHASHCODE&quot;, &quot;SCHEDULE&quot;, &quot;STATE&quot; FROM &quot;EJB__TIMER__TBL&quot; WHERE ((&quot;OWNERID&quot; = ?) AND (&quot;STATE&quot; = ?))
        bind =&gt; [2 parameters bound]
Query: ReadAllQuery(name=&quot;findTimersByOwnerAndState&quot; referenceClass=TimerState sql=&quot;SELECT &quot;TIMERID&quot;, &quot;APPLICATIONID&quot;, &quot;BLOB&quot;, &quot;CONTAINERID&quot;, &quot;CREATIONTIMERAW&quot;, &quot;INITIALEXPIRATIONRAW&quot;, &quot;INTERVALDURATION&quot;, &quot;LASTEXPIRATIONRAW&quot;, &quot;OWNERID&quot;, &quot;PKHASHCODE&quot;, &quot;SCHEDULE&quot;, &quot;STATE&quot; FROM &quot;EJB__TIMER__TBL&quot; WHERE ((&quot;OWNERID&quot; = ?) AND (&quot;STATE&quot; = ?))&quot;)
        at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
        at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644)
        at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
etc...

Different query, but same error. :(

We haven't made any changes to the JDBC connection pool __TimerPool. This is a standalone version of Glassfish (not clustered).

Obviously something has changed, but I have no idea what or how to fix it. Anyone have any insight?

Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mvatkina
Offline
Joined: 2005-04-04

Did you switch a database by any chance? Undeploy your app, stop the instance, remove the marker file (see http://docs.oracle.com/cd/E18930_01/html/821-2418/beahw.html#scrolltoc), then start the instance, deploy the app and watch for any problems of the timer service startup.

-marina

sdoca
Offline
Joined: 2010-04-22

Hi,

No, we didn't do anything with the database/timer. However, your solution (removing the marker file) worked. Still a bit of a mystery since we are not in a cluster, but happy to be moving forward.

Thanks!!!