天天看點

hornetq與jboss4內建

1、下載下傳Hornetq,URL:http://www.jboss.org/hornetq/downloads這裡使用2.2.5.Final 

2、解壓Hornetq 

3、指定需要安裝Hornetq的JBOSS4目錄 

修改hornetq-2.2.5.Final\config\jboss-as-4\build.xml手動設定JBOSS_HOME,把 

Xml代碼  

hornetq與jboss4內建
  1. <property environment="ENV"/>  

改為: 

Xml代碼  

hornetq與jboss4內建
  1. <property environment="ENV1"/>  
  2. <property name="ENV.JBOSS_HOME" value="E:/Server/jboss-4.2.2.GA"/>  

4、修正Hornetq的錯誤配置 

修改 

Java代碼  

hornetq與jboss4內建
  1. hornetq-2.2.5.Final\config\jboss-as-4\clustered\jms-ds.xml  

中的配置,删除</mbean>前的那個多餘的</attribute>标簽。 

修改 

Java代碼  

hornetq與jboss4內建
  1. hornetq-2.2.5.Final\config\jboss-as-4\clustered\ra.xml  
  2. hornetq-2.2.5.Final\config\jboss-as-4\non-clustered\ra.xml  

中的配置,因為這個配置寫錯了,把 

Xml代碼  

hornetq與jboss4內建
  1. <config-property>  
  2.   <description>The class that will locate the transactionmanager</description>  
  3.   <config-property-name>TransactionManagerLocatorMethod</config-property-name>  
  4.   <config-property-type>java.lang.String</config-property-type>  
  5.   <config-property-value>org.hornetq.integration.jboss.tm.JBoss4TransactionManagerLocator</config-property-value>  
  6. </config-property>  

改為: 

Xml代碼  

hornetq與jboss4內建
  1. <config-property>  
  2.   <description>The class that will locate the transactionmanager</description>  
  3.   <config-property-name>TransactionManagerLocatorClass</config-property-name>  
  4.   <config-property-type>java.lang.String</config-property-type>  
  5.   <config-property-value>org.hornetq.integration.jboss.tm.JBoss4TransactionManagerLocator</config-property-value>  
  6. </config-property>  

5、運作安裝 

運作hornetq-2.2.5.Final\config\jboss-as-4\build.bat,前提是要安裝JDK和ANT,安裝成功後會預設安裝兩個JBoss執行個體all-with-hornetq和default-with-hornetq,這兩執行個體是基于原來all和default執行個體配置,直接複制原來執行個體配置然後再修改的。 

6、添加啟動腳本 

到jboss-4.2.2.GA\server目錄下,添加一個批處理檔案,檔案名為JBOSS執行個體的名稱,下面的腳本會自動運作與bat檔案名稱相同的JBoss執行個體,如:default-with-hornetq.bat 

内容如下: 

Java代碼  

hornetq與jboss4內建
  1. %~dp0..\bin\run.bat -c %~n0 -b 0.0.0.0  

7、運作錯誤處理 

如果運作過程中出現以下錯誤,那說明你在複制JBOSS的執行個體的時候把data目錄的hornetq資料也複制了,解決辦法是删除data下面的所有資料。 

Java代碼  

hornetq與jboss4內建
  1. WARN  [org.hornetq.core.cluster.impl.DiscoveryGroupImpl]  There are more than one servers on the network broadcasting the same  node id. You will see this message exactly once (per node) if a node is  restarted, in which case it can be safely ignored. But if it is logged  continuously it means you really do have more than one node on the same  network active concurrently with the same node id. This could occur if  you have a backup node active at the same time as its live node.