I am sure this question has been asked countless times, but I tried everything I read and nothing works. I am sure the fix is ββprobably also very simple.
I have the following singleton that should be executed when the web application is launched, but it is not, and the scheduled task is also not executed.
@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 3.1.2 server.
Any help would be greatly appreciated.
Thanks.
EDIT
The start method now starts, but the schedule method does not start.
source share