0

I want to use the @Schedule annotation to activate a method every 5 seconds. But the scheduler never activates the method. The application runs in Open Liberty. None of the two System.out.println is displayed on the console. What is missing to make the scheduler work?

import javax.ejb.Schedule; import javax.ejb.Stateless; import javax.ejb.Timer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Stateless public class MyScheduler { private static final Logger LOG = LoggerFactory.getLogger(MyScheduler.class); public MyScheduler() { System.out.println("******* into constructor MyScheduler"); } @Schedule(second = "*/5", minute = "*", hour = "*", persistent = false) public void schedule() { System.out.println("******* into scheduler MyScheduler"); } } 
2
  • 1
    Since the comments you are replying to have been deleted by their authors, it would help keep things clean if you could delete your comments too. Commented Oct 25, 2024 at 14:04
  • I suspect that in Liberty the scheduler needs a connection the the DB. There are three tables in the database related to schedulers/timer EJBTIMER_PROP, EJPTIMER_TASK, EJBTIMER_PART. How or where is this connection defined ? Commented Oct 25, 2024 at 17:44

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.