2

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

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
JIV
  • 813
  • 2
  • 12
  • 30

3 Answers3

4

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

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
0

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>
Dev Anand Sadasivam
  • 699
  • 7
  • 21
  • 49
  • `javax.resource.spi.work.WorkManager` is a Interface. As it is a interface it didn't worked out. Instead `WorkManagerTaskExecutor` we can go for `org.springframework.jca.work.jboss.JBossWorkManagerTaskExecutor`, it is supported in `Spring 2.5` onwards – Dev Anand Sadasivam Jun 09 '15 at 11:42
  • in my case it is JBoss.... Excerpt from Spring 2.5 java doc.... Note: At the time of this writing, the `CommonJ WorkManager` facility is only supported on IBM `WebSphere 6.0+` and BEA `WebLogic 9.0+`, despite being such a crucial API for an application server. (There is a similar facility available on `WebSphere 5.1 Enterprise`, though, which we will discuss below.) On JBoss and GlassFish, a similar facility is available through the JCA WorkManager. See the `JBossWorkManagerTaskExecutor` `GlassFishWorkManagerTaskExecutor classes` which are the direct equivalent of this CommonJ adapter class. – Dev Anand Sadasivam Jun 09 '15 at 11:54
  • 1
    From Spring 4.1.6 java doc... I find this _Note: On the upcoming EE 7 compliant versions of WebLogic and WebSphere, a DefaultManagedTaskExecutor should be preferred, following JSR-236 support in Java EE 7._ – Dev Anand Sadasivam Jun 19 '15 at 05:29
0

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>
Dev Anand Sadasivam
  • 699
  • 7
  • 21
  • 49