<property environment="ENV"/>
<property environment="ENV1"/> <property name="ENV.JBOSS_HOME" value="E:/Server/jboss-4.2.2.GA"/>
hornetq-2.2.5.Final\config\jboss-as-4\clustered\jms-ds.xml
hornetq-2.2.5.Final\config\jboss-as-4\clustered\ra.xml hornetq-2.2.5.Final\config\jboss-as-4\non-clustered\ra.xml
<config-property> <description>The class that will locate the transactionmanager</description> <config-property-name>TransactionManagerLocatorMethod</config-property-name> <config-property-type>java.lang.String</config-property-type> <config-property-value>org.hornetq.integration.jboss.tm.JBoss4TransactionManagerLocator</config-property-value> </config-property>
<config-property> <description>The class that will locate the transactionmanager</description> <config-property-name>TransactionManagerLocatorClass</config-property-name> <config-property-type>java.lang.String</config-property-type> <config-property-value>org.hornetq.integration.jboss.tm.JBoss4TransactionManagerLocator</config-property-value> </config-property>
%~dp0..\bin\run.bat -c %~n0 -b 0.0.0.0
此博客转载于http://iffiffj.iteye.com/blog/1535412
另外,如果在客户端调用队列的过程中,报一下错误时,是由于你客户端用的hornetq和服务端的版本号不一致,这太坑爹了。
javax.jms.JMSException: Failed to create session factory
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:605)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:119)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:114)
at org.hornetq.jms.example.TestMain.testq(TestMain.java:53)
at org.hornetq.jms.example.TestMain.main(TestMain.java:34)
Caused by: java.lang.NullPointerException
at org.hornetq.core.client.impl.ServerLocatorImpl.removeFromConnecting(ServerLocatorImpl.java:687)
at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:756)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:601)
... 4 more
配置上的一个小注意事项
如果机器本身有多个网卡,则一定要在发现组和广播组中指定使用的是那个网卡,否则hornetq集群不会生效,具体配置如下:
<broadcast-groups>
<broadcast-group name="bg-group1">
<local-bind-address>192.168.1.106</local-bind-address> //指定使用的网卡ip地址
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<broadcast-period>5000</broadcast-period>
<connector-ref>netty</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<local-bind-address>192.168.1.106</local-bind-address> //指定使用的网卡ip地址
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>