【发布时间】:2023-03-17 07:40:02
【问题描述】:
是否有人设法在 WildFly(9.0.2 或 10.0)中部署了一个侦听独立 JCA 适配器的 MDB bean?
我刚刚创建了一个入站 JCA 适配器(使用 ironjacamar-1.2.6)并将其部署在 WildFly 上。像这样:
@Activation(messageListeners = { foo.TestMessageListener.class })
public class TestActivationSpec implements ActivationSpec
...
接下来,我添加了一个简单的连接(使用 jboss-cli):
/profile=full-ha/subsystem=resource-adapters/resource-adapter=testRA:add(archive=test.rar,transaction-support=NoTransaction)
/profile=full-ha/subsystem=resource-adapters/resource-adapter=testRA/connection-definitions=TestManagedConnectionFactory:add(class-name=foo.TestManagedConnectionFactory,jndi-name=java:/eis/TestConnectionFactory_ha)
到目前为止还很简单。之后,我为适配器创建了带有目标消费者的 WAR 应用程序:
@MessageDriven(
activationConfig = {
@ActivationConfigProperty(propertyName = "someProperty",
propertyValue = "Hi there")}
)
@Vetoed
public class TestServiceConsumer implements TestMessageListener{
...
我遇到了第一个麻烦。此 WAR 在部署期间看不到 TestMessageListener 类(顺便说一句,WildFly 缺乏规范支持)。我通过在我的 WAR 存档中添加一个特殊的专有描述符找到了一个解决方案:
META-INF/jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="deployment.test.rar" />
</dependencies>
</deployment>
</jboss-deployment-structure>
它解决了类加载问题,我的 WAR 类被允许查看 RAR 接口。但现在我看到了其他部署问题:
java.lang.IllegalStateException: WFLYEJB0383: No message listener of type foo.TestMessageListener found in resource adapter activemq-ra
那么,问题是为什么 WildFly 只查看它自己的 RA 作为监听器接口而不查看我的?有没有其他具体的描述符来解决这个问题?
需要说,我已经尝试将 ra.xml 描述添加到 RAR 存档中,添加 @ActivationConfigProperty 以指定确切的 RA 连接工厂(destinationLookup 和 connectionFactoryLookup)。没有任何帮助。
我的适配器也实现了出站处理,它按规定工作。
感谢您的建议。
【问题讨论】:
标签: java wildfly message-driven-bean jca