我创建了一个schedule方法,它可以正常工作,但是如果抛出任何异常。计时器停止,如果我尝试将我的代码包含在try catch块中,它也会掉落。 这是什么问题?!
这是我的代码
@Schedule(second = "*/1", minute = "*", hour = "*", persistent = false)
public void serviceSchedule(final Timer t) {
if (webserviceContext != null) {
lastExecutionDate = new Date();
if (availabiltyImplementation.isWSDLAvailable(webserviceContext)) {
this.checkNewTransactions(webserviceContext);
System.out.println(t);
}
}
}
这是错误消息
Info: callEJBTimeout threw exception for timer id
3@@1563351771856@@server@@domain1
javax.ejb.EJBException: Attempt to invoke when container is in Undeployed
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1984)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1979)
at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:4022)
at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1199)
at com.sun.ejb.containers.EJBTimerService.access$000(EJBTimerService.java:89)
at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:1919)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:744)