JBoss 7 ActiveMQ集成资源适配器配置

JBoss 7 ActiveMQ集成资源适配器配置,jboss,activemq,jboss7.x,activemq-artemis,resource-adapter,Jboss,Activemq,Jboss7.x,Activemq Artemis,Resource Adapter,我正在尝试使用Jboss 7.3.0和activeMQ-rar-5.6.0设置嵌入式activeMQ。 嵌入式代理应该可以从Jboss内部访问,也可以从外部访问(通过tcp从另一个应用程序访问) 当我使用“standalone.bat-c standalone full.xml”启动jboss时,我面临以下异常 **Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.ra.activemq-ra is

我正在尝试使用Jboss 7.3.0和activeMQ-rar-5.6.0设置嵌入式activeMQ。 嵌入式代理应该可以从Jboss内部访问,也可以从外部访问(通过tcp从另一个应用程序访问)

当我使用“standalone.bat-c standalone full.xml”启动jboss时,我面临以下异常

**Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.ra.activemq-ra is already registered**
我真的很感激任何关于我为什么会遇到这个异常的指导。我在下面附上了日志中的图像。

下面是我的配置

我在standalone-full.xml文件中的资源适配器子系统中添加了一个资源适配器

  <subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
            <resource-adapters>
                <resource-adapter id="activemq-ra.rar">
                    <archive>
                        activemq-ra.rar
                    </archive>
                    <transaction-support>XATransaction</transaction-support>
                   <!-- <config-property name="ServerUrl">tcp://localhost:61616</config-property> -->
                    <config-property name="ServerUrl">vm://localhost</config-property> 
                    <connection-definitions>
                        <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/activemq/ConnectionFactory" enabled="true" use-java-context="true" pool-name="ActiveMQConnectionFactoryPool" use-ccm="true">
                            <xa-pool>
                                <min-pool-size>1</min-pool-size>
                                <max-pool-size>20</max-pool-size>
                            </xa-pool>
                        </connection-definition>
                    </connection-definitions>
                    <admin-objects>
                        <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/queue/HELLOWORLDMDBQueue" use-java-context="true" pool-name="HELLOWORLDMDBQueue">
                            <config-property name="PhysicalName">HELLOWORLDMDBQueue</config-property>
                        </admin-object>
                        <admin-object class-name="org.apache.activemq.command.ActiveMQTopic" jndi-name="java:/topic/HELLOWORLDMDBTopic" use-java-context="true" pool-name="HELLOWORLDMDBTopic">
                            <config-property name="PhysicalName">HELLOWORLDMDBTopic</config-property>
                        </admin-object>
                    </admin-objects>
                </resource-adapter>
            </resource-adapters>
        </subsystem>


尝试为资源适配器存档使用其他名称。例如,使用
activemq5 ra.rar
而不是
activemq ra.rar
。我相信您与用于ActiveMQ Artemis集成的嵌入式JCA RA存在冲突


或者,您可以从服务器的XML配置中删除
消息传递
子系统。

(1)是否在
独立完整.XML中定义了
消息传递
子系统?如果是,你能分享一下吗?(2) 如果您对rar使用不同的名称(例如,
activemq5 ra.rar
),而不是
activemq ra.rar
),会发生什么情况?(3) 为什么不使用嵌入式ActiveMQ Artemis实例?@JustinBertram 1。是的,消息传递子系统在那里。我已经把它包括在上面的问题2中。我只尝试了activemq-ra.rar。将尝试使用activemq5-ra.rar 3。如何使用嵌入式ActiveMQ Artemis实例?是否通过在standalone-full.xml中定义消息传递子系统内的队列?如果是这种情况,我不需要activemq-ra.rar和我在standalone-full.xml中添加的资源适配器配置,因为您配置了
消息传递
子系统(该子系统启用activemq Artemis的嵌入式实例,包括其JCA ra的嵌入式实例)这可能与您试图在
资源适配器
子系统中配置的
activemqra.rar
冲突。你是否需要这一切真的取决于你想做什么。您是否正在尝试配置嵌入到JBoss EAP中的JMS代理,以便向它发送和使用消息?如果是这样,您应该使用ActiveMQ Artemis的嵌入式实例。感谢Justin的回复。是的,我正在尝试配置JMS代理并发送消息并异步读取它们。为了使用嵌入式ActiveMQ Artemis实例,我在消息传递子系统中将以下队列定义为
。使用“jms/queue/testQ”的名称,可以从jboss内外访问testQ吗?您最好澄清(即完全重写)您的原始问题,而不是在评论部分提出新问题。谢谢Justin,为资源适配器使用不同于
activemq ra.rar
的名称解决了该异常。
 <subsystem xmlns="urn:jboss:domain:ejb3:6.0">
            <session-bean>
                <stateless>
                    <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
                </stateless>
                <stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>
                <singleton default-access-timeout="5000"/>
            </session-bean>
            <mdb>
                <!--<resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/> -->
                <resource-adapter-ref resource-adapter-name="activemq-ra.rar"/>
                <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
            </mdb>
 <subsystem xmlns="urn:jboss:domain:messaging-activemq:8.0">
            <server name="default">
                <statistics enabled="${wildfly.messaging-activemq.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
                <security-setting name="#">
                    <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
                </security-setting>
                <address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
                <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
                <http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
                    <param name="batch-delay" value="50"/>
                </http-connector>
                <in-vm-connector name="in-vm" server-id="0">
                    <param name="buffer-pooling" value="false"/>
                </in-vm-connector>
                <http-acceptor name="http-acceptor" http-listener="default"/>
                <http-acceptor name="http-acceptor-throughput" http-listener="default">
                    <param name="batch-delay" value="50"/>
                    <param name="direct-deliver" value="false"/>
                </http-acceptor>
                <in-vm-acceptor name="in-vm" server-id="0">
                    <param name="buffer-pooling" value="false"/>
                </in-vm-acceptor>
                <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
                <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
                <jms-queue name="myTestQ" entries="java:jboss/exported/jms/queue/myTestQ"/>
                <connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
                <connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
                <pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
            </server>
        </subsystem>
<resourceadapter-class>org.apache.activemq.ra.ActiveMQResourceAdapter</resourceadapter-class>
        <config-property>
            <description>
              The URL to the ActiveMQ server that you want this connection to connect to.  If using
              an embedded broker, this value should be 'vm://localhost'.
            </description>
            <config-property-name>ServerUrl</config-property-name>
            <config-property-type>java.lang.String</config-property-type>
            <config-property-value>tcp://localhost:61616</config-property-value>
            <!--<config-property-value>vm://localhost</config-property-value> -->
        </config-property>
<config-property>
            <description>
              Sets the XML configuration file used to configure the embedded ActiveMQ broker via 
              Spring if using embedded mode.
              
              BrokerXmlConfig is the filename which is assumed to be on the classpath unless 
              a URL is specified. So a value of foo/bar.xml would be assumed to be on the 
              classpath whereas file:dir/file.xml would use the file system. 
              Any valid URL string is supported.              
            </description>
            <config-property-name>BrokerXmlConfig</config-property-name>
            <config-property-type>java.lang.String</config-property-type>
            <config-property-value></config-property-value>
            
             <description>To use the broker-config.xml from the root for the RAR </description>
               <config-property-value>xbean:broker-config.xml</config-property-value>
           <!--  To use an external file or url location
               <config-property-value>xbean:file:///amq/config/jee/broker-config.xml</config-property-value>
            -->
        </config-property>