jboss-4.2.3.GA++apache-activemq-5.1.0整合

一.整合需要的环境.
jdk1.6
jboss-4.2.3.GA
apache-activemq-5.1.0(直接解压就可以用。)
二.整合步骤
1. 解压activemq-rar-5.1.0.rar到 jboss-4.2.3.GA
\server\default\deploy\activemq-ra.rar (activemq-rar-5.1.0.rar在apache-activemq-5.1.0\lib\optional下面找到)。
2.xbean-spring-3.3.jar剪贴到jboss-4.2.3.GA\server\default\lib下。
3.修改META-INF\ra.xml,让JBoss使用broker-config.xml 作为默认的配置文件配置borker. 修改下面的地方
<config-property-value>config-property-value>
<!-- <config-property-value>xbean:broker-config.xml</config-property-value>-->
     改为:
<!-- <config-property-value></config-property-value> -->
<config-property-value>xbean:broker-config.xml<config-property-value>

    表示使用broker-config.xml来配置启动ActiveMQ.
4.修改borker-config.xml,默认的borker-config.xml会产生一个错误,无论是我使用的版本还是最后的snapshot版本,默认的borker-config.xml都会让xbean-spring 3.3抛出exception.解决的办法如下

<beans xmlns="http://activemq.org/config/1.0">
<broker useJmx="true" >

改为

<beans>
<broker useJmx="true" xmlns="http://activemq.org/config/1.0">
三 使用整合完毕的ActiveMQ作为ds绑定到JBoss的JNDI服务。
编写jboss-4.0.5.GA\server\default\depoly\activemq-ds.xml xml 代码如下:<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE connection-factories
PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
"http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">

<connection-factories>

<tx-connection-factory>
<jndi-name>activemq/QueueConnectionFactory</jndi-name>
<xa-transaction/>
<track-connection-by-tx/>
<rar-name>activemq-ra.rar</rar-name>
<connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
<ServerUrl>vm://localhost</ServerUrl>
<!--
<UserName>sa</UserName>
<Password></Password>
-->
<min-pool-size>1</min-pool-size>
<max-pool-size>200</max-pool-size>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<idle-timeout-minutes>3</idle-timeout-minutes>
</tx-connection-factory>

<tx-connection-factory>
<jndi-name>activemq/TopicConnectionFactory</jndi-name>
<xa-transaction/>
<track-connection-by-tx/>
<rar-name>activemq-ra.rar</rar-name>
<connection-definition>javax.jms.TopicConnectionFactory</connection-definition>
<ServerUrl>vm://localhost</ServerUrl>
<!--
<UserName>sa</UserName>
<Password></Password>
-->
<min-pool-size>1</min-pool-size>
<max-pool-size>200</max-pool-size>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<idle-timeout-minutes>3</idle-timeout-minutes>
</tx-connection-factory>

<mbean code="org.jboss.resource.deployment.AdminObject" name="activemq.queue:name=outboundQueue">
<attribute name="JNDIName">activemq/queue/outbound</attribute>
<depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra.rar'</depends>
<attribute name="Type">javax.jms.Queue</attribute>
<attribute name="Properties">PhysicalName=queue.outbound</attribute>
</mbean>

<mbean code="org.jboss.resource.deployment.AdminObject" name="activemq.topic:name=inboundTopic">
<attribute name="JNDIName">activemq/topic/inbound</attribute>
<depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra.rar'</depends>
<attribute name="Type">javax.jms.Topic</attribute>
<attribute name="Properties">PhysicalName=topic.inbound</attribute>
</mbean>

</connection-factories>


然后在将spring-context.jar,spring-core.jar,spring-beans.jar添加到
activemq-ra.rar下。
四。启动jboss如果出现:
17:03:27,421 INFO [BrokerService] Using Persistence Adapter: JournalPersistenceAdapator(JDBCPersistenceAdaptor(org.apache.derby.jdbc.EmbeddedDataSource@5971c3))
17:03:27,421 INFO [BrokerService] ActiveMQ 5.1.0 JMS Message Broker (bruce.broker1) is starting
17:03:27,421 INFO [BrokerService] For help or more information please see: http://activemq.apache.org/
17:03:27,484 INFO [ManagementContext] JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1199/jmxrmi
17:03:28,421 INFO [JDBCPersistenceAdapter] Database driver recognized: [apache_derby_embedded_jdbc_driver]
17:03:29,296 INFO [DefaultDatabaseLocker] Attempting to acquire the exclusive lock to become the Master broker
17:03:29,312 INFO [DefaultDatabaseLocker] Becoming the master on dataSource: org.apache.derby.jdbc.EmbeddedDataSource@5971c3
17:03:29,343 INFO [JournalPersistenceAdapter] Journal Recovery Started from: Active Journal: using 5 x 20.0 Megs at: D:\jboss-4.2.3.GA\data\journal就代表你成功了。
如果在出现:
17:06:05,984 INFO [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@b36022: defining beans [org.apache.activemq.xbean.XBeanBrokerService]; root of factory hierarchy
17:06:06,125 INFO [BrokerService] Using Persistence Adapter: JournalPersistenceAdapator(JDBCPersistenceAdaptor(org.apache.derby.jdbc.EmbeddedDataSource@de6570))
17:06:06,140 INFO [BrokerService] ActiveMQ 5.1.0 JMS Message Broker (bruce.broker1) is starting
17:06:06,140 INFO [BrokerService] For help or more information please see: http://activemq.apache.org/
17:06:06,140 WARN [ManagementContext] Failed to start jmx connector: Cannot bind to URL [rmi://localhost:1099/jmxrmi]: javax.naming.CommunicationException
解决方法:
在broker-config.xml中添加:
<managementContext>
<managementContext createConnector="true" connectorPort="1199"/>
</managementContext>
然后启动jboss。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值