问题描述
如何在JBoss AS 6上将QuartzScheduler服务注入我的无状态bean?在JBoss AS 6启动期间,Quartz服务确实启动
00:58:38,025 INFO [QuartzScheduler]计划程序元数据:Quartz Scheduler(v1.8.3)'JBossQuartzScheduler'with instanceId'NON_CLUSTERED'
调度器类:'org.quartz.core.QuartzScheduler' - 在本地运行。
未开始。
目前处于待机模式。
执行的作业数:0
使用线程池'org.quartz.simpl.SimpleThreadPool' - 有10个线程。
使用job-store'org.quartz.simpl.RAMJobStore' - 它不支持持久性。并不集群。
00:58:38,026 INFO [StdSchedulerFactory]从外部打开的InputStream初始化了Quartz调度程序JBossQuartzScheduler。
00:58:38,026 INFO [StdSchedulerFactory] Quartz调度程序版本:1.8.3
i尝试这样:
@Stateless(name =myEnterpriseScheduler)
public class MyEnterpriseScheduler {
@ Resource(name =JBossQuartzScheduler)
调度程序调度程序;
}
但是,我得到以下异常:
00:58:40,583错误[AbstractKernelController]安装到Instantiated时出错:name = jboss.jacc:id =vfs: //Users/merodach/Downloads/jboss-6.0.0.Final/server/default/deploy/EnterpriseSchedular-ear.ear\",service=jacc state =描述模式=手动requiredState =已配置:java.lang.Error:错误服务器:预期构造函数参数和提供的参数之间的不匹配。
在org.jboss.mx.server.MBeanServerImpl.handleInstantiateExceptions(MBeanServerImpl.java:1317)[:6.0.0.GA]
在org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl。 java:1249)[:6.0.0.GA]
在org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:288)[:6.0.0.GA]
在org。 jboss.system.ServiceCreator.installPlainMBean(ServiceCreator.java:217)[:6.0.0.Final(Build SVNTag:JBoss_6.0.0.Final date:20101228)]
在org.jboss.system.ServiceCreator.install( ServiceCreator.java:133)[:6.0.0.Final(构建SVNTag:JBoss_6.0.0.Final date:20101228)]
在org.jboss.system.microcontainer.InstantiateAction.installAction(InstantiateAction.java:73) [:2.2.0.GA]
在org.jboss.system.microcontainer.InstantiateAction.installAction(InstantiateAction.java:46)[:2.2.0.GA]
在org.jboss.dependency。 plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins .AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379)[jboss- dependency.jar:2.2.0.GA]
在org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:301)[:2.2.0.GA]
在org.jboss。 dependency.plugins.AbstractController.install(AbstractController.java:2044)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322)[jboss-dependency.jar:2.2.0.GA ]
在org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins。 AbstractController.resolveContexts(AbstractController.java:1139)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939)[jboss依赖.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654)[jboss-dependency.jar:2.2.0.GA]
at org.jboss.system.ServiceController.doChange(ServiceController.java:671)[:6.0.0.Final(Build SVNTag:JBoss_6.0.0.Final date:20101228)]
在org.jboss.system.ServiceController。 install(ServiceController.java:257)[:6.0.0.Final(Build SVNTag:JBoss_6.0.0.Final date:20101228)]
在org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java: 93)[:6.0.0.Final]
在org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDe p.rar // b $ b在org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55)[:2.2.0.GA]
在org.jboss.deployers.plugins.deployers.DeployerWrapper .deploy(DeployerWrapper.java:179)[:2.2.0.GA]
在org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832)[:2.2.0.GA]
在org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550)[:2.2.0.GA]
在org.jboss.deployers.plugins.deployers.DeployersImpl。 doInstallParentFirst(DeployersImpl.java:1571)[:2.2.0.GA]
在org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491)[:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379)[jboss依赖。 jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044)[jboss-dependency.jar:2.2.0.GA]
在org .jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java :1322)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246)[jboss-dependency.jar:2.2.0。 GA]
在org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins .AbstractController.change(AbstractController.java:939)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654)[jboss- dependency.jar:2.2.0.GA]
在org.jboss.deployers.p lugins.deployers.DeployersImpl.change(DeployersImpl.java:1983)[:2.2.0.GA]
在org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076)[:2.2 .0.GA]
在org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679)[:2.2.0.GA]
在org.jboss.system.server .profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106)[:6.0.0.Final]
在org.jboss.profileservice.dependency.ProfileControllerContext $ DelegateDeployer.process(ProfileControllerContext.java:143)[: 0.2.2]
在org.jboss.profileservice.dependency.ProfileDeployAction.deploy(ProfileDeployAction.java:151)[:0.2.2]
在org.jboss.profileservice.dependency.ProfileDeployAction.installActionInternal( ProfileDeployAction.java:94)[:0.2.2]
在org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)[jboss-kernel.jar:2.2.0.GA]
在org.jboss.kernel.plugins.dependency.Inst allsAwareAction.installAction(InstallsAwareAction.java:42)[jboss-kernel.jar:2.2.0.GA]
在org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)[jboss -dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractControllerContext。 install(AbstractControllerContext.java:379)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044)[jboss-dependency.jar :2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083)[jboss-dependency.jar:2.2.0.GA]
在org。 JBoss的.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246 )[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.dependency.plugins.AbstractController .change(AbstractController.java:654)[jboss-dependency.jar:2.2.0.GA]
在org.jboss.profileservice.dependency.ProfileActivationWrapper $ BasicProfileActivation.start(ProfileActivationWrapper.java:190)[:0.2 .2]
在org.jboss.profileservice.dependency.ProfileActivationWrapper.start(ProfileActivationWrapper.java:87)[:0.2.2]
在org.jboss.profileservice.dependency.ProfileActivationSe rvice.activateProfile(ProfileActivationService.java:215)[:0.2.2]
在org.jboss.profileservice.dependency.ProfileActivationService.activate(ProfileActivationService.java:159)[:0.2.2]
在org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.activate(AbstractProfileServiceBootstrap.java:112)[:0.2.2]
在org.jboss.profileservice.resolver.BasicResolverFactory $ ProfileResolverFacade.deploy(BasicResolverFactory.java:87)[ :0.2.2]
在org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.start(AbstractProfileServiceBootstrap.java:91)[:0.2.2]
在org.jboss.system.server.profileservice.bootstrap .BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:132)[:6.0.0.Final]
在org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56)[:6.0。 0.Final]
在org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java: 827)[jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
在org.jboss.bootstrap.impl.base.server.AbstractServer $ StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
在java.lang.Thread.run(Thread.java:680)[:1.6.0_22]
任何想法?
更新:这是我的用例:
i想要动态创建cron触发器,这些触发器是从分布式环境中使用cron表达式的其他进程提交的,而不是注释静态。在激活给定表达式的触发器之后,这些请求将被RESTful服务捕获并保存到数据库中。这些cron触发器调度客户端/应用程序发送并保存在数据库中的任务。
这篇文章怎么样?
How can i inject QuartzScheduler service into my Stateless bean on JBoss AS 6 ?Quartz service does start during JBoss AS 6 startup
00:58:38,025 INFO [QuartzScheduler] Scheduler meta-data: Quartz Scheduler (v1.8.3) 'JBossQuartzScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
00:58:38,026 INFO [StdSchedulerFactory] Quartz scheduler 'JBossQuartzScheduler' initialized from an externally opened InputStream.
00:58:38,026 INFO [StdSchedulerFactory] Quartz scheduler version: 1.8.3
i have tried this:
@Stateless(name="myEnterpriseScheduler")
public class MyEnterpriseScheduler {
@Resource(name="JBossQuartzScheduler")
Scheduler scheduler;
}
But then i get the following exception:
00:58:40,583 ERROR [AbstractKernelController] Error installing to Instantiated: name=jboss.jacc:id="vfs:///Users/merodach/Downloads/jboss-6.0.0.Final/server/default/deploy/EnterpriseSchedular-ear.ear",service=jacc state=Described mode=Manual requiredState=Configured: java.lang.Error: Error in the server: mismatch between expected constructor arguments and supplied arguments.
at org.jboss.mx.server.MBeanServerImpl.handleInstantiateExceptions(MBeanServerImpl.java:1317) [:6.0.0.GA]
at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:1249) [:6.0.0.GA]
at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:288) [:6.0.0.GA]
at org.jboss.system.ServiceCreator.installPlainMBean(ServiceCreator.java:217) [:6.0.0.Final (Build SVNTag:JBoss_6.0.0.Final date: 20101228)]
at org.jboss.system.ServiceCreator.install(ServiceCreator.java:133) [:6.0.0.Final (Build SVNTag:JBoss_6.0.0.Final date: 20101228)]
at org.jboss.system.microcontainer.InstantiateAction.installAction(InstantiateAction.java:73) [:2.2.0.GA]
at org.jboss.system.microcontainer.InstantiateAction.installAction(InstantiateAction.java:46) [:2.2.0.GA]
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:301) [:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.system.ServiceController.doChange(ServiceController.java:671) [:6.0.0.Final (Build SVNTag:JBoss_6.0.0.Final date: 20101228)]
at org.jboss.system.ServiceController.install(ServiceController.java:257) [:6.0.0.Final (Build SVNTag:JBoss_6.0.0.Final date: 20101228)]
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:93) [:6.0.0.Final]
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:49) [:6.0.0.Final]
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) [:2.2.0.GA]
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1571) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) [:2.2.0.GA]
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) [:2.2.0.GA]
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) [:2.2.0.GA]
at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) [:6.0.0.Final]
at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:143) [:0.2.2]
at org.jboss.profileservice.dependency.ProfileDeployAction.deploy(ProfileDeployAction.java:151) [:0.2.2]
at org.jboss.profileservice.dependency.ProfileDeployAction.installActionInternal(ProfileDeployAction.java:94) [:0.2.2]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.GA]
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]
at org.jboss.profileservice.dependency.ProfileActivationWrapper$BasicProfileActivation.start(ProfileActivationWrapper.java:190) [:0.2.2]
at org.jboss.profileservice.dependency.ProfileActivationWrapper.start(ProfileActivationWrapper.java:87) [:0.2.2]
at org.jboss.profileservice.dependency.ProfileActivationService.activateProfile(ProfileActivationService.java:215) [:0.2.2]
at org.jboss.profileservice.dependency.ProfileActivationService.activate(ProfileActivationService.java:159) [:0.2.2]
at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.activate(AbstractProfileServiceBootstrap.java:112) [:0.2.2]
at org.jboss.profileservice.resolver.BasicResolverFactory$ProfileResolverFacade.deploy(BasicResolverFactory.java:87) [:0.2.2]
at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.start(AbstractProfileServiceBootstrap.java:91) [:0.2.2]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:132) [:6.0.0.Final]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_22]
any idea?
UPDATE: Here is my use case:i want to create the cron triggers dynamically which are submitted from other processes using cron expressions in a distributed environment, not with annotations statically. these requests are caught by a RESTful service, and saved into the database, after the triggers with given expressions are activated. These cron triggers schedule tasks which are also sent by clients/applications and saved in database.
How about this post? https://community.jboss.org/wiki/HowToConfigureAQuartzService
这篇关于JBoss AS 6中的QuartzScheduler注入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!