I have the following singleton which should be executed when the web application starts but it does not, and the scheduled task does not run either.
@Singleton
@Startup
public class Scheduler {
private static int count = 0;
@PostConstruct
public void onStartup() {
System.out.println("Initialization success.");
}
@Schedule(second="*/10", minute="*", hour="*")
public void execute() {
System.out.println("its running count..."+count);
count++;
}
}
I am using Glassfish server 3.1.2.
EDIT
The startup method is now being executed but the schedule method does not run.