0

我正在尝试连接到 WMQ 和 Solace 消息传递框架以使用来自两者的消息 我有多个 WMQ 侦听器,但是在尝试将另一个侦听器关联/绑定到 solace 适配器时,应用程序无法启动

因为只有最后一个听众才能得到安慰

参考文件

<?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 但仍然可以在 jboss-ejb3.xml 中覆盖它,如果我只使用一个侦听器作为 solace 适配器,它就可以正常工作。

<mdb>
                <resource-adapter-ref resource-adapter-name="wmq.jmsra.rar"/>
                <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
            </mdb>

仅当我尝试将多个带有 solace 的侦听器用作资源适配器时才会出现问题。

感谢您的帮助。谢谢。

4

1 回答 1

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>
于 2016-10-14T07:29:18.623 回答