Integrating ActiveMQ 5.3.0 with JBoss 6.0.0(调试成功activemq5.8.0+jboss6.1.0)

 

12/15/2009

This document explains how ActiveMQ 5.3.0 can be configured in JBoss Application Server 6.0.0 as an embedded broker.

Software Requirements
Here is the list of softwares used in this document.
Apache ActiveMQ 5.3.0
JBoss AS 6.0.0
JDK 1.6+
This article used  Windows XP Professional as the operating system.

Intallation
Step 1: Install JDK 1.6 and verify it runs correctly. After installing Java set JAVA_HOME and update PATH environment variables.
C:\>java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)
Step 2:  Install JBoss Application Server 6.0.0 and make sure Server starts correctly. After downloading jboss-6.0.0M1.zip, extract it to a folder. After extrating start the server using run command.

Goto JBoss extracted folder and execute below commands.
C:\>cd JBoss\jboss-6.0.0.M1\bin
C:\JBoss\jboss-6.0.0.M1\bin>run
First few line shows the configuration used by JBoss Server. Check the last line to see whether the server has started propertly.
C:\JBoss\jboss-6.0.0.M1\bin>run
Calling C:\JBoss\jboss-6.0.0.M1\bin\run.conf.bat
===============================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: C:\JBoss\jboss-6.0.0.M1

  JAVA: C:\Program Files\Java\jdk1.6.0_14\bin\java

  JAVA_OPTS: -Dprogram.name=run.bat -Xms128M -Xmx512M -XX:MaxPermSize=256M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dorg.jboss.resolver.warning=true -server

  CLASSPATH: C:\Program Files\Java\jdk1.6.0_14\lib\tools.jar;C:\JBoss\jboss-6.0.0.M1\bin\run.jar

===============================================================================

17:01:33,828 INFO  [AbstractJBossASServerBase] Server Configuration:
        JBOSS_HOME URL: file:/C:/JBoss/jboss-6.0.0.M1/
        Bootstrap: $JBOSS_HOME\server/default/conf/bootstrap.xml
        Common Base: $JBOSS_HOME\common/
        Common Library: $JBOSS_HOME\common/lib/
        Server Name: default
        Server Base: $JBOSS_HOME\server/
        Server Library: $JBOSS_HOME\server/default/lib/
        Server Config: $JBOSS_HOME\server/default/conf/
        Server Home: $JBOSS_HOME\server/default/
        Server Data: $JBOSS_HOME\server/default/data/
        Server Log: $JBOSS_HOME\server/default/log/
        Server Temp: $JBOSS_HOME\server/default/tmp/
17:01:33,875 INFO  [AbstractServer] Starting: JBossAS [6.0.0.M1 (build: SVNTag=JBoss_6_0_0_M1 date=200912040958)]
17:01:35,515 INFO  [AbstractMCServerBase] Starting Microcontainer, Main bootstrapURL=file:/C:/JBoss/jboss-.0.0.M1/server/default/conf/bootstrap.xml
17:01:37,250 INFO  [VFSCacheFactory] Initializing VFSCache [org.jboss.virtual.plugins.cache.CombinedVFSCache]
17:01:37,250 INFO  [VFSCacheFactory] Using VFSCache [CombinedVFSCache[real-cache: null]]
17:01:38,140 INFO  [CopyMechanism] VFS temp dir: C:\JBoss\jboss-6.0.0.M1\server\default\tmp
17:01:38,140 INFO  [ZipEntryContext] VFS force nested jars copy-mode is enabled.
17:01:41,921 INFO  [ServerInfo] Java version: 1.6.0_14,Sun Microsystems Inc.
17:01:41,921 INFO  [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
17:01:41,921 INFO  [ServerInfo] Java VM: Java HotSpot(TM) Server VM 14.0-b16,Sun Microsystems Inc.
17:01:41,921 INFO  [ServerInfo] OS-System: Windows XP 5.1,x86
...............
...............
17:03:22,437 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
17:03:22,468 INFO  [AbstractServer] JBossAS [6.0.0.M1 (build: SVNTag=JBoss_6_0_0_M1 date=200912040958)] Started in 1m:48s:593ms
To ensure the server has started, visit  http://localhost:8080/web-console/ in your favorite browser and make sure you can see JBoss Web Console.
Now stop JBoss Server using shutdown script(inside <jboss_home>\bin folder) or use Ctrl-C.

Integrating Apache ActiveMQ with the JBoss Application Server. 
Download ApacheMQ using the link above.  After downloading, extract it to a folder and verify that ActiveMQ RAR file is included. This file can be located at [ ACTIVEMQ_INSTALL_DIR]\lib\optional folder.
C:\Softwares\apache-activemq-5.3.0\lib\optional>dir
           102,631 activeio-core-3.1.2.jar
            81,267 activemq-jmdns_1.0-5.3.0.jar
           116,081 activemq-optional-5.3.0.jar
            38,517 activemq-pool-5.3.0.jar
         6,905,784 activemq-rar-5.3.0.rar
           175,130 activemq-xmpp-5.3.0.jar
           118,726 commons-beanutils-1.6.1.jar
            30,085 commons-codec-1.2.jar
           575,389 commons-collections-3.2.1.jar
           121,757 commons-dbcp-1.2.2.jar
           305,001 commons-httpclient-3.1.jar
           197,067 commons-net-2.0.jar
            87,077 commons-pool-1.4.jar
            37,477 geronimo-j2ee-connector_1.5_spec-2.0.0.jar
            67,758 jettison-1.1.jar
           367,444 log4j-1.2.14.jar
           325,942 spring-aop-2.5.6.jar
           488,282 spring-beans-2.5.6.jar
           476,940 spring-context-2.5.6.jar
           285,491 spring-core-2.5.6.jar
           195,350 spring-jms-2.5.6.jar
            15,980 spring-oxm-tiger-1.5.8.jar
           231,173 spring-tx-2.5.6.jar
           474,413 wstx-asl-3.0.1.jar
           130,519 xbean-spring-3.6.jar
            24,544 xmlpull-1.1.3.4d_b4_min.jar
           431,406 xstream-1.3.1.jar
In our case ActiveMQ RAR file name will be  activemq-rar-5.3.0.rar.

Now go to JBoss intallation folder and create a folder for ActiveMQ inside  deploy directory for the required context. Here we are using  default JBoss context.
C:\JBoss\jboss-6.0.0.M1\server\default\deploy>mkdir activemq-rar-5.3.0.rar
Extract the contents of ActiveMQ RAR file(activemq-rar-5.3.0.rar) to this folder.
102,631 activeio-core-3.1.2.jar
         2,923,854 activemq-core-5.3.0.jar
           147,717 activemq-protobuf-1.0.jar
            85,474 activemq-ra-5.3.0.jar
             4,467 aopalliance-1.0.jar
             1,868 broker-config.xml
            52,915 commons-logging-1.1.jar
            44,598 commons-logging-api-1.1.jar
           197,067 commons-net-2.0.jar
         2,141,382 derby-10.1.3.1.jar
            16,030 geronimo-j2ee-management_1.0_spec-1.0.jar
            20,220 geronimo-j2ee-management_1.1_spec-1.0.1.jar
           152,481 kahadb-5.3.0.jar
           367,444 log4j-1.2.14.jar
             1,625 log4j.properties
    <DIR>          META-INF
           488,282 spring-beans-2.5.6.jar
           476,940 spring-context-2.5.6.jar
           285,491 spring-core-2.5.6.jar
           130,519 xbean-spring-3.6.jar
Now we can start configuring ActiveMQ.

Edit  ra.xml file inside  [JBOSS_HOME]\server\default\deploy\activemq-rar-5.3.0.rar\META-INF folder.
<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>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>xbean:broker-config.xml</config-property-value>
</config-property>
A Pre-Configured  ra.xml can be downladed.

The  broker-config.xml file inside  [JBOSS_HOME]\server\default\deploy\activemq-rar-5.3.0.rar is the ActiveMQ configuration file. This is the file used to configure ActiveMQ. The default contents of this file are usable, but should be customized to suit your environment.

A Pre-Configured  broker-config.xml can be downloaded.

Now start JBoss server to ensure it start without any errors using the same commands we used before. If JBoss Server starts without any errors you can move to next step. Stop the server and continue to next step.

Next step is to configure JBoss to initialize and start ActiveMQ whenever JBoss starts up. This is accomplished by putting an XML ( activemq-jms-ds.xml) inside  [JBOSS_HOME]\server\default\deploy.

A Pre-Configured  activemq-jms-ds.xml can be downloaded.

 Now start JBoss server to ensure it start without any errors using the same commands we used before.  Examine the startup messages for ActiveMQ messages.
21:20:17,453 INFO  [RARDeployment] Required license terms exist, view vfszip:/C:
/JBoss/jboss-6.0.0.M1/server/default/deploy/mail-ra.rar/META-INF/ra.xml
21:20:17,515 INFO  [RARDeployment] Required license terms exist, view vfszip:/C:
/JBoss/jboss-6.0.0.M1/server/default/deploy/quartz-ra.rar/META-INF/ra.xml
21:20:17,968 INFO  [AdminObject] Bound admin object 'org.apache.activemq.command
.ActiveMQQueue' at 'activemq/queue/outbound'
21:20:17,984 INFO  [AdminObject] Bound admin object 'org.apache.activemq.command
.ActiveMQTopic' at 'activemq/topic/inbound'
21:20:18,171 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager
'jboss.jca:service=ConnectionFactoryBinding,name=activemq/QueueConnectionFactory'
to JNDI name 'java:activemq/QueueConnectionFactory'
21:20:18,281 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager
'jboss.jca:service=ConnectionFactoryBinding,name=activemq/TopicConnectionFactory' 
to JNDI name 'java:activemq/TopicConnectionFactory'

Now our environment is ready to go.
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Go语言(也称为Golang)是由Google开发的一种静态强类型、编译型的编程语言。它旨在成为一门简单、高效、安全和并发的编程语言,特别适用于构建高性能的服务器和分布式系统。以下是Go语言的一些主要特点和优势: 简洁性:Go语言的语法简单直观,易于学习和使用。它避免了复杂的语法特性,如继承、重载等,转而采用组合和接口来实现代码的复用和扩展。 高性能:Go语言具有出色的性能,可以媲美C和C++。它使用静态类型系统和编译型语言的优势,能够生成高效的机器码。 并发性:Go语言内置了对并发的支持,通过轻量级的goroutine和channel机制,可以轻松实现并发编程。这使得Go语言在构建高性能的服务器和分布式系统时具有天然的优势。 安全性:Go语言具有强大的类型系统和内存管理机制,能够减少运行时错误和内存泄漏等问题。它还支持编译时检查,可以在编译阶段就发现潜在的问题。 标准库:Go语言的标准库非常丰富,包含了大量的实用功能和工具,如网络编程、文件操作、加密解密等。这使得开发者可以更加专注于业务逻辑的实现,而无需花费太多时间在底层功能的实现上。 跨平台:Go语言支持多种操作系统和平台,包括Windows、Linux、macOS等。它使用统一的构建系统(如Go Modules),可以轻松地跨平台编译和运行代码。 开源和社区支持:Go语言是开源的,具有庞大的社区支持和丰富的资源。开发者可以通过社区获取帮助、分享经验和学习资料。 总之,Go语言是一种简单、高效、安全、并发的编程语言,特别适用于构建高性能的服务器和分布式系统。如果你正在寻找一种易于学习和使用的编程语言,并且需要处理大量的并发请求和数据,那么Go语言可能是一个不错的选择。
Go语言(也称为Golang)是由Google开发的一种静态强类型、编译型的编程语言。它旨在成为一门简单、高效、安全和并发的编程语言,特别适用于构建高性能的服务器和分布式系统。以下是Go语言的一些主要特点和优势: 简洁性:Go语言的语法简单直观,易于学习和使用。它避免了复杂的语法特性,如继承、重载等,转而采用组合和接口来实现代码的复用和扩展。 高性能:Go语言具有出色的性能,可以媲美C和C++。它使用静态类型系统和编译型语言的优势,能够生成高效的机器码。 并发性:Go语言内置了对并发的支持,通过轻量级的goroutine和channel机制,可以轻松实现并发编程。这使得Go语言在构建高性能的服务器和分布式系统时具有天然的优势。 安全性:Go语言具有强大的类型系统和内存管理机制,能够减少运行时错误和内存泄漏等问题。它还支持编译时检查,可以在编译阶段就发现潜在的问题。 标准库:Go语言的标准库非常丰富,包含了大量的实用功能和工具,如网络编程、文件操作、加密解密等。这使得开发者可以更加专注于业务逻辑的实现,而无需花费太多时间在底层功能的实现上。 跨平台:Go语言支持多种操作系统和平台,包括Windows、Linux、macOS等。它使用统一的构建系统(如Go Modules),可以轻松地跨平台编译和运行代码。 开源和社区支持:Go语言是开源的,具有庞大的社区支持和丰富的资源。开发者可以通过社区获取帮助、分享经验和学习资料。 总之,Go语言是一种简单、高效、安全、并发的编程语言,特别适用于构建高性能的服务器和分布式系统。如果你正在寻找一种易于学习和使用的编程语言,并且需要处理大量的并发请求和数据,那么Go语言可能是一个不错的选择。
Go语言(也称为Golang)是由Google开发的一种静态强类型、编译型的编程语言。它旨在成为一门简单、高效、安全和并发的编程语言,特别适用于构建高性能的服务器和分布式系统。以下是Go语言的一些主要特点和优势: 简洁性:Go语言的语法简单直观,易于学习和使用。它避免了复杂的语法特性,如继承、重载等,转而采用组合和接口来实现代码的复用和扩展。 高性能:Go语言具有出色的性能,可以媲美C和C++。它使用静态类型系统和编译型语言的优势,能够生成高效的机器码。 并发性:Go语言内置了对并发的支持,通过轻量级的goroutine和channel机制,可以轻松实现并发编程。这使得Go语言在构建高性能的服务器和分布式系统时具有天然的优势。 安全性:Go语言具有强大的类型系统和内存管理机制,能够减少运行时错误和内存泄漏等问题。它还支持编译时检查,可以在编译阶段就发现潜在的问题。 标准库:Go语言的标准库非常丰富,包含了大量的实用功能和工具,如网络编程、文件操作、加密解密等。这使得开发者可以更加专注于业务逻辑的实现,而无需花费太多时间在底层功能的实现上。 跨平台:Go语言支持多种操作系统和平台,包括Windows、Linux、macOS等。它使用统一的构建系统(如Go Modules),可以轻松地跨平台编译和运行代码。 开源和社区支持:Go语言是开源的,具有庞大的社区支持和丰富的资源。开发者可以通过社区获取帮助、分享经验和学习资料。 总之,Go语言是一种简单、高效、安全、并发的编程语言,特别适用于构建高性能的服务器和分布式系统。如果你正在寻找一种易于学习和使用的编程语言,并且需要处理大量的并发请求和数据,那么Go语言可能是一个不错的选择。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值