我正在尝试连接到WMQ和Solace消息传递框架以使用来自两者的消息 我有多个WMQ侦听器,但在尝试将另一个侦听器关联/绑定到安慰适配器时,应用程序无法启动
因为只有最后一个听众被绑定才能得到安慰
参考文件
<?xml version="1.1" encoding="UTF-8"?>
<jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="urn:clustering:1.0" xmlns:r="urn:resource-adapter-binding"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
version="3.1" impl-version="2.0">
<enterprise-beans>
<message-driven>
<ejb-name>CoreMessageEventListener</ejb-name>
<ejb-class>com.slohiya.ListenerA</ejb-class>
<activation-config>
<activation-config-property>
.
.
.
</activation-config-property>
</activation-config>
</message-driven>
<message-driven>
<ejb-name>ListenerB</ejb-name>
<ejb-class>com.slohiya.ListenerB</ejb-class>
<activation-config>
<activation-config-property>
.
.
.
</activation-config-property>
</activation-config>
</message-driven>
<message-driven>
<ejb-name>ListenerX</ejb-name>
<ejb-class>com.slohiya.ListenerX</ejb-class>
<activation-config>
<activation-config-property>
.
.
.
</activation-config-property>
</activation-config>
</message-driven>
<message-driven>
<ejb-name>ListenerY</ejb-name>
<ejb-class>com.slohiya.ListenerY</ejb-class>
<activation-config>
<activation-config-property>
.
.
.
</activation-config-property>
</activation-config>
<message-driven>
</enterprise-beans>
<assembly-descriptor>
<r:resource-adapter-binding>
<ejb-name>ListenerA</ejb-name>
<r:resource-adapter-name>wmq.jmsra.rar</r:resource-adapter-name>
</r:resource-adapter-binding>
</assembly-descriptor>
<assembly-descriptor>
<r:resource-adapter-binding>
<ejb-name>ListenerB</ejb-name>
<r:resource-adapter-name>wmq.jmsra.rar</r:resource-adapter-name>
</r:resource-adapter-binding>
</assembly-descriptor>
<assembly-descriptor>
<r:resource-adapter-binding>
<ejb-name>ListenerX</ejb-name>
<r:resource-adapter-name>com.solacesystems.ra</r:resource-adapter-name>
</r:resource-adapter-binding>
</assembly-descriptor>
<assembly-descriptor>
<r:resource-adapter-binding>
<ejb-name>ListenerY</ejb-name>
<r:resource-adapter-name>com.solacesystems.ra</r:resource-adapter-name>
</r:resource-adapter-binding>
</assembly-descriptor>
</jboss:ejb-jar>
所以在这种情况下,JBOSS试图将ListenerX与wmq.jmra.rar关联并失败。
在standalone.xml中,默认适配器是wmq但是stil,应该可以在jboss-ejb3.xml中覆盖它,如果我只使用一个用于安慰适配器的监听器,它可以正常工作。
<mdb>
<resource-adapter-ref resource-adapter-name="wmq.jmsra.rar"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
只有当我尝试使用具有安慰性的多个侦听器作为资源适配器时才会出现问题。
感谢您的帮助。感谢。
答案 0 :(得分:1)
我现在正在使用程序集描述符工作。
我相信问题是你有多个<assembly-descriptor>
部分导致JBoss的奇怪行为。
以下是jboss-ejb3.xml示例:
<?xml version="1.1" encoding="UTF-8"?>
<jboss xmlns:jboss="http://www.jboss.com/xml/ns/javaee" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="urn:clustering:1.0"
xmlns:r="urn:resource-adapter-binding"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
version="3.1" impl-version="2.0">
<enterprise-beans>
<message-driven>
<ejb-name>MDB1</ejb-name>
<ejb-class>com.test.MDB1</ejb-class>
<activation-config>
...
</activation-config>
</message-driven>
<message-driven>
<ejb-name>MDB2</ejb-name>
<ejb-class>com.test.MDB2</ejb-class>
<activation-config>
...
</activation-config>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<r:resource-adapter-binding>
<ejb-name>MDB1</ejb-name>
<r:resource-adapter-name>com.solacesystems.ra</r:resource-adapter-name>
</r:resource-adapter-binding>
<r:resource-adapter-binding>
<ejb-name>MDB2</ejb-name>
<r:resource-adapter-name>com.solacesystems.ra</r:resource-adapter-name>
</r:resource-adapter-binding>
</assembly-descriptor>
</jboss>