0

我正在尝试使用 CommonJWorkManagerTaskExecutor作为 Quartz 的任务执行器,SchedulerFactoryBean以避免 WebSphere 中的非托管线程(在此处描述——向下滚动到“Quartz With CommonJ”部分)。不幸的是,我似乎无法查找任何默认的 WebSphere WorkManagers,也无法查找我创建的任何东西。CommonJ 的 Spring bean WorkManager

<bean id="taskExecutor" class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor">
    <property name="workManagerName" value="wm/default" />
</bean>

我收到ServiceNotInitializedException: AsynchBeans Service not initialized错误和堆栈跟踪:

Exception in thread "P=166330:O=0:CT" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduler' defined in class path resource [spring-quartz-config.xml]: Cannot resolve reference to bean 'taskExecutor' while setting bean property 'taskExecutor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskExecutor' defined in class path resource [spring-quartz-config.xml]: Invocation of init method failed; nested exception is com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is com.ibm.ws.asynchbeans.ServiceNotInitializedException: AsynchBeans Service not initialized]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at com.lmig.am.claims.clip.test.TestQuartz.main(TestQuartz.java:12)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskExecutor' defined in class path resource [spring-quartz-config.xml]: Invocation of init method failed; nested exception is com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is com.ibm.ws.asynchbeans.ServiceNotInitializedException: AsynchBeans Service not initialized]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
    ... 15 more
Caused by: com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is com.ibm.ws.asynchbeans.ServiceNotInitializedException: AsynchBeans Service not initialized]
    at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:1033)
    at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:730)
    at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:3678)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1848)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1749)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1500)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:637)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:165)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179)
    at javax.naming.InitialContext.lookup(InitialContext.java:436)
    at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
    at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
    at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
    at org.springframework.scheduling.commonj.WorkManagerTaskExecutor.afterPropertiesSet(WorkManagerTaskExecutor.java:137)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
    ... 22 more
Caused by: com.ibm.ws.asynchbeans.ServiceNotInitializedException: AsynchBeans Service not initialized
    at com.ibm.ws.asynchbeans.J2EEServiceManager.getSelf(J2EEServiceManager.java:286)
    at com.ibm.ws.asynchbeans.AsynchContextDescriptorImpl2.inflateContext(AsynchContextDescriptorImpl2.java:164)
    at com.ibm.ws.asynchbeans.AsynchContextDescriptorImpl2.<init>(AsynchContextDescriptorImpl2.java:84)
    at com.ibm.ws.asynchbeans.AsynchBeanManager.<init>(AsynchBeanManager.java:150)
    at com.ibm.ws.asynchbeans.AsynchBeanManager.<init>(AsynchBeanManager.java:182)
    at com.ibm.ws.asynchbeans.AsynchBeanManager.<init>(AsynchBeanManager.java:195)
    at com.ibm.ws.asynchbeans.WorkManagerImpl.<init>(WorkManagerImpl.java:190)
    at com.ibm.ws.asynchbeans.naming.WorkManagerFactory.createWorkManager(WorkManagerFactory.java:290)
    at com.ibm.ws.asynchbeans.naming.WorkManagerFactory.getObjectInstance(WorkManagerFactory.java:205)
    at javax.naming.spi.NamingManager.getObjectInstanceByFactoryInReference(NamingManager.java:485)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:350)
    at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:927)
    ... 39 more

有什么想法可以解决这个问题吗?谢谢!

4

1 回答 1

2

WebSphere asynchbeans 只能从应用程序服务器进程中使用。从堆栈跟踪中,您尝试从您编写的 TestQuartz 主方法中使用它,并且 asynchbeans 抛出异常以指示它没有在该 JVM 中作为服务器初始化的一部分启动。

于 2011-10-19T16:48:12.220 回答