Search code examples
javatimerjava-ee-7

JavaEE Timer Service


I am trying to work with the Timer Service with JavaEE 7 and local GlassFish 4.1.

I wrote this simple class (I saw it in some example):

@Stateless
public class Tasker {

    @Schedule(second = "*", minute = "*", hour = "*")
    public void executeTask() {
        System.out.println("Task");
    }
}

But when I deploy the project, I get that error:

 java.lang.RuntimeException: EJB Timer Service is not available  
 ...   
 java.lang.NoClassDefFoundError: Could not initialize class org.apache.derby.jdbc.EmbeddedDriver

I don't know why this happening. I am very new in JavaEE and I didn't find anything helpful.

How can I make it work?


Solution

  • Reinstalling the GlashFish server and adding persistent = false to @Schedule solved the problem.