Search code examples
javascheduled-tasksejb-3.1job-schedulingjboss-eap-6

MSC000001: Failed to start service of the type Schedule


I am refactoring a class responsible for performing jobs scheduled. So, I just removed a method and now the .ear artifact isn't deploy.

Original class:

@Stateless(name = "jobScheduleService")
public class JobScheduleService {

    @Inject
    private FormService formService;;

    @EJB
    private EliminationService eliminationService;

    @Schedules({
            @Schedule(hour = "23", minute = "50")
    })
    public void remind() throws MessagingException {
        formService.sendDeadlineReminder();
    }

    @Schedules({
            @Schedule(hour = "2", minute = "00")
    })
    public void eliminatesOutOfDate() {
        this.eliminationService.eliminatesOutOfDate();
    }
}

Class with eliminatesOutOfDate() method removed:

@Stateless(name = "jobScheduleService")
public class JobScheduleService {

    @Inject
    private FormService formService;

    @Schedules({
            @Schedule(hour = "23", minute = "50")
    })
    public void remind() throws MessagingException {
        formService.sendDeadlineReminder();
    }
}

The stacktrace:

15:29:27,480 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.subunit."test-ear-1.11.0-DEV.ear"."test-ejb-1.0-SNAPSHOT.jar".component.jobScheduleService.ejb3.timerService: org.jboss.msc.service.StartException in service jboss.deployment.subunit."test-ear-1.11.0-DEV.ear"."test-ejb-1.0-SNAPSHOT.jar".component.jobScheduleService.ejb3.timerService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1936) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_151]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_151]
    at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_151]
Caused by: java.lang.NullPointerException
    at org.jboss.as.ejb3.timerservice.TimerServiceImpl.doesTimeoutMethodMatch(TimerServiceImpl.java:928)
    at org.jboss.as.ejb3.timerservice.TimerServiceImpl.restoreTimers(TimerServiceImpl.java:679)
    at org.jboss.as.ejb3.timerservice.TimerServiceImpl.start(TimerServiceImpl.java:189)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
    ... 3 more

and

15:29:29,136 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 38) JBAS014612: Falha na operação ("deploy") - endereço ({"deployment" => "test-ear-1.11.0-DEV.ear"}) - falha na descrição: {"JBAS014671: Falha de serviços" => {"jboss.deployment.subunit.\"test-ear-1.11.0-DEV.ear\".\"test-ejb-1.0-SNAPSHOT.jar\".component.jobScheduleService.ejb3.timerService" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"test-ear-1.11.0-DEV.ear\".\"test-ejb-1.0-SNAPSHOT.jar\".component.jobScheduleService.ejb3.timerService: Failed to start service
    Caused by: java.lang.NullPointerException"}}
15:29:29,136 ERROR [org.jboss.as.server] (management-handler-thread - 38) JBAS015870: O procedimento da implantação "test-ear-1.11.0-DEV.ear" foi revertido com falha de mensagem 
{"JBAS014671: Falha de serviços" => {"jboss.deployment.subunit.\"test-ear-1.11.0-DEV.ear\".\"test-ejb-1.0-SNAPSHOT.jar\".component.jobScheduleService.ejb3.timerService" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"test-ear-1.11.0-DEV.ear\".\"test-ejb-1.0-SNAPSHOT.jar\".component.jobScheduleService.ejb3.timerService: Failed to start service
    Caused by: java.lang.NullPointerException"}}

I'm not understanding why the exception occurs.


Solution

  • Despite being a Wildfly question, this is the same (resolved) issue: Deploying Java @Schedule with Wildfly 8.1.0 Final