使用Wildfly 8.1.0 Final部署Java @Schedule [英] Deploying Java @Schedule with Wildfly 8.1.0 Final

查看:168
本文介绍了使用Wildfly 8.1.0 Final部署Java @Schedule的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码测试@Schedule注释:

I am trying to test the @Schedule annotation with the following code:

import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Startup;

@Singleton
@Startup
public class TimerTest {

    public TimerTest() {

    }

    @Schedule(second = "*", minute = "*", hour = "*")
    public void sayHello() {
        System.out.println("Hello");
    }

}

然而,当我将其部署到wildfly 8.1.0的独立实例(最终)我在日志中收到以下错误消息:

However, when I deploy it to the standalone instance of wildfly 8.1.0 (final) I am getting the following error messages in the logs:

2014-09-23 08:38:03,076 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."test-server.war".component.TimerTest.ejb3.timerService: org.jboss.msc.service.StartException in service jboss.deployment.unit."test-server.war".component.TimerTest.ejb3.timerService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
    at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: java.lang.NullPointerException
    at org.jboss.as.ejb3.timerservice.TimerServiceImpl.doesTimeoutMethodMatch(TimerServiceImpl.java:959)
    at org.jboss.as.ejb3.timerservice.TimerServiceImpl.restoreTimers(TimerServiceImpl.java:710)
    at org.jboss.as.ejb3.timerservice.TimerServiceImpl.start(TimerServiceImpl.java:202)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    ... 3 more

2014-09-23 08:38:07,098 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "test-server.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"test-server.war\".component.TimerTest.ejb3.timerService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"test-server.war\".component.TimerTest.ejb3.timerService: Failed to start service
    Caused by: java.lang.NullPointerException"}}

2014-09-23 08:38:07,145 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."test-server.war".component.TimerTest.ejb3.timerService: org.jboss.msc.service.StartException in service jboss.deployment.unit."test-server.war".component.TimerTest.ejb3.timerService: Failed to start service

JBAS014777:   Services which failed to start:      service jboss.deployment.unit."test-server.war".component.TimerTest.ejb3.timerService

关于可能导致此问题的任何想法?

Any ideas as to what could be causing this?

推荐答案

我之前见过这个。在WildFly目录中,假设您进行了独立部署,则会有一个目录standalone / data / timer-service-data。该目录中可能存在一些旧的timerService数据。关闭服务器,删除此数据并重试。

I've seen this before. In your WildFly directory, asuming you did a standalone deployment, there will be a directory standalone/data/timer-service-data. There is probably some old timerService data in that directory. Shut down the server, delete this data and try again.

这可能是在服务器关闭之前未完成的测试运行的数据。请记住,timerService是持久的。因此,如果在关闭服务器时有待处理的任务,它将首先尝试接收这些任务。如果您更新了战争,那么计时器进程可能不再与战争中的进程相匹配。

This is probably data from a test run that did not complete before the server shut down. Remember that the timerService is persistent. So if there are pending tasks when you shut down the server, it will try to pick up those tasks first. If you updated your war those timer processes will probably not match the processes in the war anymore.

这篇关于使用Wildfly 8.1.0 Final部署Java @Schedule的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆