1

I am using the wildfly maven plugin to deploy my Java app to a local jboss server.

I created a class with a @Scheduleannotation like this:

@Startup
@Singleton
@Slf4j
public class ClassName {

  @Schedule(hour = "*", minute = "*", second = "*/20", persistent = false)
  public void method() {
    // Code
    log.info("some log");
  }
}

Now, when deploying I get the following error:

ERROR [org.jboss.as.ejb3.timer] (EJB default - 1) WFLYEJB0020: Error invoking timeout for timer: [id=879a76e7-b06d-458c-a722-70d8f1d40bc2 timedObjectId=xx-yy-server-1.0-SNAPSHOT.xx-yy-server-1.0-SNAPSHOT.ClassName auto-timer?:true persistent?:false timerService=org.jboss.as.ejb3.timerservice.TimerServiceImpl@42cdd9a initialExpiration=null intervalDuration(in milli sec)=0 nextExpiration=Tue Oct 15 17:21:00 CEST 2019 timerState=IN_TIMEOUT info=null]: javax.ejb.EJBException: java.lang.NullPointerException

Does anyone have any idea what is causing this? I am rather new to scheduling in Java so it might be something stupid, but I could not find anything online.

Thanks!

ppgcc74
  • 397
  • 4
  • 16

1 Answers1

1

Hello, so as this Stackoverflow question mentioned all the Timeout restrictions apply and more than it is recommended using @Stateless EJB instead of @Singleton when you have multiple timers that will be scheduled.

The @Startup annotation is to inform the EJB container to initialize the bean at the startup, you might be misusing it.