1

We use an Websphere 8 Application Server and I want to use the servers workmanager in our webapplication. I am trying to get a reference to a jca workmanager javax.resource.spi.work.Workmanager to use it with Springs org.springframework.jca.work.WorkManagerTaskExecutor.

The resource-ref in the web.xml looks like this:

<resource-ref>
 <res-ref-name>workmanager/web</res-ref-name>
 <res-type>javax.resource.spi.work.WorkManager</res-type>
 <res-auth>Container</res-auth>
 <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

Using that configuration, i get the following exception:

Caused by: com.ibm.ws.asynchbeans.exception.AsynchBeanException: ASYN0064E: The value javax.resource.spi.work.WorkManager of the res-type resource reference element WorkManager is not right. Only the following values are allowed: com.ibm.websphere.asynchbeans.WorkManager, commonj.work.WorkManager.
at com.ibm.ws.asynchbeans.naming.WorkManagerFactory.validateWMResRef(WorkManagerFactory.java:379)
at com.ibm.ws.asynchbeans.naming.WorkManagerFactory.getObjectInstance(WorkManagerFactory.java:147)
at org.apache.aries.jndi.ObjectFactoryHelper$7.run(ObjectFactoryHelper.java:338)
at java.security.AccessController.doPrivileged(AccessController.java:362)
at org.apache.aries.jndi.Utils.doWithRestoredPrivileges(Utils.java:155)
at org.apache.aries.jndi.ObjectFactoryHelper.getObjectInstanceUsingObjectFactoryBuilders(ObjectFactoryHelper.java:336)
at org.apache.aries.jndi.ObjectFactoryHelper.doGetObjectInstance(ObjectFactoryHelper.java:136)
at org.apache.aries.jndi.ObjectFactoryHelper.access$000(ObjectFactoryHelper.java:60)
at org.apache.aries.jndi.ObjectFactoryHelper$1.run(ObjectFactoryHelper.java:98)
at java.security.AccessController.doPrivileged(AccessController.java:327)
at org.apache.aries.jndi.Utils.doPrivileged(Utils.java:146)
at org.apache.aries.jndi.ObjectFactoryHelper.getObjectInstance(ObjectFactoryHelper.java:96)
at org.apache.aries.jndi.OSGiObjectFactoryBuilder.getObjectInstance(OSGiObjectFactoryBuilder.java:57)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:349)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:993)
... 89 more

It says here my resource-ref must be of the type com.ibm.websphere.asynchbeans.WorkManager or commonj.work.WorkManager. Neither of them extends from the JCA-Workmanager-Interface.

If I switch the resource type to commonj.work.WorkManager and use Springs org.springframework.scheduling.commonj.WorkManagerTaskExecutor in my application, everything works fine.

To get a JCA Workmanager working with Websphere, do I need to configure something special on server-side? I havent found any setting in the admin-console to switch the implementation. Websphere 8 supports Java EE 6, so it should be able to deal with JCA.

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
Lykourgos
  • 43
  • 7

1 Answers1

1

Why do you want to use JCA-specific WorkManagerTaskExecutor rather than the commonj one? The JCA WorkManager is only intended to be used by resource adapters, not referenced by arbitrary EE components, and the Spring documentation for the JCA-specific WorkManagerTaskExecutor is consistent with that:

This is mainly intended for use within a JCA ResourceAdapter implementation

Just use the commonj WorkManager and corresponding WorkManagerTaskExecutor.

Brett Kail
  • 33,593
  • 2
  • 85
  • 90
  • Hi, thanks for the answer, in the end i just did it exactly like this. Now i use the commonj-interface `commonj.work.WorkManager` to get the reference to the workmanager and use the corresponding TaskExecutor in our application. Honestly, its my first time dealing with this on an application server, and I wanted to use the JCA-workmanager because i thought it would be the more "standard way" to do it, because its in the java ee specification. – Lykourgos Mar 23 '15 at 12:37
  • 1
    Unfortunately, prior to EE 7, there was no EE standard mechanism for executing asynchronous tasks. As of EE 7, the JSR 236 API allows this, and spring has ConcurrentTaskExecutor to adapt. The WebSphere Application Server Liberty profile has a JSR 236 implementation. – Brett Kail Mar 24 '15 at 21:31