首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JBoss 7 ActiveMQ集成资源适配器配置

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

Stack Overflow用户
提问于 2020-11-18 02:32:38
回答 1查看 2K关注 0票数 1

我正在尝试用JBoss7.3.0和activeMQ 5.6.0安装一个嵌入式activemq。嵌入式代理应该可以从Jboss内部访问,也可以从外部访问(通过tcp从另一个应用程序访问)

当我用'standalone.bat -c独立-Ful.xml‘启动jboss时,我将面临以下异常

代码语言:javascript
复制
**Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.ra.activemq-ra is already registered**

我真的很感激任何关于为什么我会得到这个异常的指导。我在下面附上了日志中的一张图片.

下面是我的配置。

我在独立的-Ful.xml文件中的资源适配器子系统中添加了一个资源适配器。

代码语言:javascript
复制
  <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>

我在独立的-Ful.xml文件中更新了mdb标记中的资源适配器-ref。

代码语言:javascript
复制
 <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>

独立-Ful.xml中的消息传递子系统是

代码语言:javascript
复制
 <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>

我更新了ra.xml文件,将ServerUrl更改为tcp://localhost:61616

代码语言:javascript
复制
<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>

并将META/ra.xml中的config-property BrokerXmlConfig的config-property值设置为xbean:Brokerconfig.xml。

代码语言:javascript
复制
<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>

我创建了一个新的activemq-ra.rar文件,并将其放在jboss 7.3\独立\部署文件夹中。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-11-23 00:47:53

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

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64886176

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档