我们使用Websphere 8 Application Server,我想在webapplication中使用服务器workmanager。我正在尝试获取对jca workmanager javax.resource.spi.work.Workmanager
的引用,以便将其与Springs org.springframework.jca.work.WorkManagerTaskExecutor
一起使用。
web.xml中的resource-ref如下所示:
<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>
使用该配置,我得到以下异常:
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
它在这里说我的resource-ref必须是com.ibm.websphere.asynchbeans.WorkManager
或commonj.work.WorkManager
类型。它们都不是从JCA-Workmanager-Interface延伸出来的。
如果我将资源类型切换为commonj.work.WorkManager
并在我的应用程序中使用弹簧org.springframework.scheduling.commonj.WorkManagerTaskExecutor
,那么一切正常。
要让JCA Workmanager与Websphere一起工作,我是否需要在服务器端配置一些特殊的东西?我还没有在管理控制台中找到任何设置来切换实现。 Websphere 8支持Java EE 6,因此它应该能够处理JCA。
答案 0 :(得分:1)
为什么要使用特定于JCA的WorkManagerTaskExecutor而不是commonj? JCA WorkManager仅供资源适配器使用,而不是由任意EE组件引用,而JCA特定的WorkManagerTaskExecutor的Spring documentation与之一致:
这主要用于JCA ResourceAdapter 实施
只需使用commonj WorkManager和相应的WorkManagerTaskExecutor。