2

My job annotated with @Scheduled does not fire the task. I am using Wildfly 10

deltaspike-scheduler-module 1.5.3

quartz 2.2.2

Quartz alone works fine.

My actual code problem:

@Scheduled(cronExpression = "0 * * * * ?")
public class CronTask implements Job{

static public final Logger log = Logger.getLogger(CronTask.class.getName());

@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
    log.info("Run");
    System.out.println("aaaaa");


  }

}

Any help is welcome.

PS: This code on Jboss EAP works

icaro56
  • 167
  • 9

3 Answers3

0

I will use EJB Timer 3.2.

tutorial below:

http://www.mastertheboss.com/jboss-server/wildfly-8/creating-clustered-ejb-3-timers

icaro56
  • 167
  • 9
0

I made it work that way, I use Deltaspike. Try another cron expression, like 0 0/1 * * * ? that should trigger it once per minute

McCoy
  • 780
  • 1
  • 10
  • 21
0

i hat to make it @ApplicationScoped to get picked up!

    @AppplicationScoped
    @Scheduled(cronExpression = "0 * * * * ?")
    public class CronTask implements Job{

    static public final Logger log = Logger.getLogger(CronTask.class.getName());

    @Override
    public void execute(JobExecutionContext arg0) throws JobExecutionException {
        log.info("Run");
        System.out.println("aaaaa");
      }
    }

Wildfly 16, Deltaspike Version 1.9.1

womd
  • 3,077
  • 26
  • 20