gpt4 book ai didi

jakarta-ee - 使用 Wildfly 8.1.0 Final 部署 Java @Schedule

转载 作者:行者123 更新时间:2023-12-04 13:38:55 25 4
gpt4 key购买 nike

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

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 (final) 的独立实例时,我在日志中收到以下错误消息:
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

关于可能导致这种情况的任何想法?

最佳答案

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

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

关于jakarta-ee - 使用 Wildfly 8.1.0 Final 部署 Java @Schedule,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25988818/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com