MSC000001: 无法启动 Schedule 类型的服务

MSC000001: Failed to start service of the type Schedule

我正在重构一个 class 负责执行计划的作业。所以,我刚刚删除了一个方法,现在 .ear 工件没有部署。

原文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 删除了 eliminatesOutOfDate() 方法:

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

    @Inject
    private FormService formService;

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

堆栈跟踪:

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

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"}}

我不明白为什么会出现异常。

尽管是 Wildfly 问题,但这是同一个(已解决)问题:Deploying Java @Schedule with Wildfly 8.1.0 Final

  • 用户对分辨率的评论:Deploying Java @Schedule with Wildfly 8.1.0 Final
  • 其他评论: