0

I'm trying to schedule tasks in my Java EE application without the use of any database, including any in-memory-databases like derby. The reason why I'm trying to do this, is that I have to deploy my application on a cluster where no database is available.

To reproduce the problem I'm having, here is a minimal java example:

package testPackage;

import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Startup;

@Startup
@Singleton
public class Scheduler {

    @Schedule(second="*", persistent=false)
    public void hello() {
        System.out.println("Hello");
    }
}

When disabling the jdbc/__TimerPool locally, I get the same error as when I'm trying to deploy on the cluster: enter image description here

This results in the exception: javax.naming.NamingException: Lookup failed for 'jdbc/__TimerPool' in SerialContext. The exception however disappears if I remove the @Schedule annotation, which means that by itself the application does not need the TimerPool.

Is it possible to use non-persistent scheduling without any database in Java EE?

Jakob
  • 1,156
  • 3
  • 15
  • 26
  • Maybe this answers your question. Have a look at the accepted answer. https://stackoverflow.com/questions/13092567/automatic-ejb-timer-on-glassfish-server-not-triggering/13102822#13102822 – Dragomir Kolev Aug 18 '17 at 11:21
  • Still the same problem with that approach – Jakob Aug 18 '17 at 12:30
  • This is caused if your Scheduler was first deployed when `persistent` was not set. You will have to completely undeploy your service and redeploy it. In some cases, you can go to the container and delete the folder where the persistent scheduler exists. – Buhake Sindi Aug 22 '17 at 08:41

0 Answers0