我正在使用 Quartz 2.1.1 并且有一个 JAR 应用程序(注意,不是网络,所以我没有 Spring)。我在 JBoss 4.2.2 上运行我的应用程序(无法更改)。我想安排我的作业每 5 分钟运行一次,但不希望通过静态块创建调度程序。无论如何,它似乎不起作用。在我的工作课上,我有...
static {
LOG.info("Started static process orders job at " + (new java.util.Date()).toString());
final JobDetail job = JobBuilder.newJob(ProcessOrdersJob.class).withIdentity("processOrdersJob", "group1").build();
final Trigger trigger = TriggerBuilder
.newTrigger()
.withIdentity("processOrdesrTrigger", "group1")
.withSchedule(
CronScheduleBuilder
.cronSchedule("0 5,10,15,20,25,30,35,40,45,50,55 * * * ?"))
.build();
Scheduler scheduler;
try {
scheduler = new StdSchedulerFactory().getScheduler();
scheduler.start();
scheduler.scheduleJob(job, trigger);
} catch (SchedulerException e) {
LOG.error(e.getMessage(), e);
e.printStackTrace(System.err);
}
} // static
但它似乎没有运行(日志从不包含信息消息)。有谁知道在我的 JAR 中配置我的 Quartz 作业以部署到 JBoss 的更灵活的方法?
谢谢, -
编辑:我尝试了 Rosdi 的建议,将我的 Maven 构建使用的 Quartz 恢复为 1.5.2(与 JBoss 安装的版本相同),但是,唉,得到了例外
javax.ejb.EJBTransactionRolledbackException: java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:249)
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:268)
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:138)
at $Proxy113.execute(Unknown Source)
at org.jboss.resource.adapter.quartz.inflow.QuartzJob.execute(QuartzJob.java:57)
at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:174)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
... 11 more
Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.<clinit>(BeanValidationIntegrator.java:53)
at org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(IntegratorServiceImpl.java:46)
at org.hibernate.service.internal.BootstrapServiceRegistryImpl.<init>(BootstrapServiceRegistryImpl.java:80)
at org.hibernate.service.internal.BootstrapServiceRegistryImpl.<init>(BootstrapServiceRegistryImpl.java:57)
at org.hibernate.service.ServiceRegistryBuilder.<init>(ServiceRegistryBuilder.java:76)
at org.mainco.subco.dido.service.AbstractServiceProvider.getSessionFactory(AbstractServiceProvider.java:67)
at org.mainco.subco.dido.service.AbstractServiceProvider.initServices(AbstractServiceProvider.java:118)
at org.mainco.subco.dido.quartz.ProcessOrdersJob.execute(ProcessOrdersJob.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)