1
votes

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!

1
What does the first part of the stack trace look like? - stdunbar
Do you specifically need it to be in startup bean? - M. Prokhorov
@M.Prokhorov Thanks for your reply. I do not, actually. I added the @Startup later because I thought it might fix the described issue (it obviously did not). - ppgcc74
@stdunbar I will update this post with the stack trace once I am back in the office in about 13 hours. Thanks for you reply! - ppgcc74
add the complete stack trace - Francisco Melo junior

1 Answers

1
votes

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.