Lotus教程、Java教程、Java虚拟机、Java软件综合开发社区

Lotus、Domino、Java、C#、Web、数据库综合开发教程、资料社区

java开发环境tomcat spring配置



Published by admin on 04月 23, 2009

tomcat  spring配置并集成ActiveMQ,欢迎在线阅读学习tomcat教程.

tomcat spring配置

先来温顾一下ActiveMQ5.0提供的主要功能:

    1.ActiveMQ5.0消息中间件实现了JMS1.1规范

    2.支持点对点、发布/订阅式消息;

    3.支持持久消息;

    开始tomcat5.5 + sprng2.0 + ActiveMQ的配置

    目标:

    1.tomcat启动时,也同时启时ActiveMQ服务

    2.配置发送、接收消息的模板,使代码编写不必再配置发送、接收过程,而可以直接对消息做处理

    参考文档:

    http://activemq.apache.org

    http://www.springside.org.cn/

    一.准备工作:

    所需jar

    activeMQ

    SPRING

    XBEAN

    jakarta-commons

    …

    二.Tomcat中启动ActiverMQ的配置(Spring整合)
    <?xml version=”1.0″ encoding=”UTF-8″?>

    <web-app version=”2.4″

    xmlns=”http://java.sun.com/xml/ns/j2ee

    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance

    xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee

    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd“>

    <welcome-file-list>

        <welcome-file>index.jsp</welcome-file>

    </welcome-file-list>

    <context-param>

        <param-name>contextConfigLocation</param-name>

        <param-value>

          classpath:incx/activemq/conf/spring-activeMQ-service.xml

        </param-value>

    </context-param>

    <listener>

        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

    </listener>

    </web-app>

————————— spring-activeMQ-service.xml —————————-

    <beans>

    xmlns=”http://www.springframework.org/schema/beans

    xmlns:amq=”http://activemq.org/config/1.0

    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance

    xsi:schemaLocation=”http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

    http://activemq.org/config/1.0 http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd“>

    <!– Server configure –>

    <!– create an embedded ActiveMQ Broker –>

    <amq:broker useJmx=”false” persistent=”false”>

        <amq:transportConnectors>

          <amq:transportConnector uri=”tcp://localhost:61616″/>

        </amq:transportConnectors>

    </amq:broker>

    </beans>



【版权说明】:本网页上有部分内容来源于网上收集,但不能保证资料的完整性和准确性,仅提供参考和学习。如有侵权请立即通知我们,我们将立即删除,谢谢合作!

Comments are closed.