Spring WorkManagerTaskExecutor cannot initialize in websphere

二次信任 提交于 2019-12-23 02:33:11

问题


i want use Websphere work manager for executing async jobs in jee context but i have problem with creating spring WorkManager.

bean definition:

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

this definition i found in websphere help. But problem is this ends with noClassDefFound. I noticed pckg org.springframework.scheduling.commonj is missing from spring-context since version 2.x.x

Is it replaced with org.springframework.jca.work.WorkManagerTaskExecutor ?

when i use this other spring class, i get error:

Caused by: org.springframework.jndi.TypeMismatchNamingException: Object of type [class com.ibm.ws.asynchbeans.WorkManagerImpl] available at JNDI location [wm/default] is not assignable to [javax.resource.spi.work.WorkManager]

so whats deal here? thx

was - 7.0.0.23 spring - 3.1.2


回答1:


Class org.springframework.scheduling.commonj.WorkManagerTaskExecutor resides in spring-context-support-3.1.2.RELEASE.jar




回答2:


Configuration succeeds with javax.resource.spi.work.WorkManager in applicationContext-service.xml in deployment.....

In my case deployment fails for bean injection org.springframework.scheduling.commonj.WorkManagerTaskExecutor as it fails to take WorkManager JNDI Configured in Application Server.... I just replaced javax.resource.spi.work.WorkManager. And so far it is success deployment.

I yet to see application works fine with it.

<bean id="taskExecutor" class="javax.resource.spi.work.WorkManager">
    <property name="workManagerName" value="wm/default" /> 
</bean>



回答3:


In our scenario we were managed it by ThreadPoolTaskExecutor instead of WorkManagerTaskExecutor

Here is configuration that comes in ApplicationContext.xml

<!-- 
<bean id="rtSenderTaskExecutor"
    class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor">
    <property name="workManagerName">
        <value>${org.quartz.threadPool.jndi}</value>
    </property>
</bean> -->

<!-- Local Thread Pool -->    
<bean id="rtSenderTaskExecutor"
    class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
    <property name="corePoolSize" value="${org.quartz.threadPool.corePoolSize}" />
    <property name="maxPoolSize" value="${org.quartz.threadPool.maxPoolSize}" />
    <property name="queueCapacity" value="${org.quartz.threadPool.queueCapacity}" />
    <property name="keepAliveSeconds" value="${org.quartz.threadPool.keepAliveSeconds}"></property>
</bean>


来源:https://stackoverflow.com/questions/20051172/spring-workmanagertaskexecutor-cannot-initialize-in-websphere

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!