关闭

关于ActiveMQ的学习

标签: activemq
1515人阅读 评论(0) 收藏 举报

一、安装ActiveMQ

下载ActiveMQ

下载地址:http://activemq.apache.org/download.html

我用的是apache-activemq-5.9.0-bin.zip

解压apache-activemq-5.9.0-bin.zip

进入bin目录

我用的是win7 64位系统


如果直接运行bin目录下的activemq.bat文件会闪退

然后我进入win64目录运行activemq.bat

这时不会出现闪退,但是运行有错误  提示JAVA_HOME没有设置

然后这时需要在环境变量中配置JAVA_HOME

设置完环境变量之后运行还是报错  提示:wrapper  | Critical error: wait for JVM process failed


在网上找了半天也没解决问题,最后发现不能运行win64目录里面的activemq.bat

然后我运行win32目录里的activemq.bat终于启动了




另外安装ActiveMQ时还应注意以下问题:

一、在官网上下载ActiveMQ解压之后设置ActiveMQ环境变量

二、注意ActiveMQ的安装路径不能有空格
“F:\Program Files\apache-activemq-5.10.0”
像这种路径启动ActiveMQ的时候就会有问题,提示:找不到或无法加载


关于Maven构建Spring3.1 MVC + Hibernate4.1 + ActiveMQ整合的问题

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <springversion>3.1.1.RELEASE</springversion>
    <junitversion>3.8.1</junitversion>
  </properties>
  <dependencies>
    <!-- junit start -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <!-- junit end -->
    <!-- jstl start -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.1.2</version>
    </dependency>
    <!-- jstl end -->
    <!-- spring 3.1 mvc start -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aop</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-asm</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aspects</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context-support</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-expression</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jms</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-orm</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-oxm</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
      <version>3.1</version>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.1</version>
    </dependency>
    <dependency>
	  <groupId>org.jasypt</groupId>
	  <artifactId>jasypt</artifactId>
	  <version>1.7.1</version>
    </dependency>
    <dependency>
	  <groupId>org.codehaus.jackson</groupId>
	  <artifactId>jackson-core-asl</artifactId>
	  <version>1.9.13</version>
    </dependency>
    <dependency>
	  <groupId>org.codehaus.jackson</groupId>
	  <artifactId>jackson-jaxrs</artifactId>
	  <version>1.9.13</version>
    </dependency>
    <dependency>
	  <groupId>org.codehaus.jackson</groupId>
	  <artifactId>jackson-mapper-asl</artifactId>
	  <version>1.9.13</version>
    </dependency>
    <!-- Spring 3.1 mvc end -->
    
    <!-- hibernate 4.1 start -->
    <dependency>
	  <groupId>org.hibernate</groupId>
	  <artifactId>hibernate-entitymanager</artifactId>
	  <version>4.1.0.Final</version>
    </dependency>
    <dependency>
	  <groupId>org.hibernate</groupId>
	  <artifactId>hibernate-core</artifactId>
	  <version>4.1.2</version>
	</dependency>
	<dependency>
	  <groupId>org.hibernate.javax.persistence</groupId>
	  <artifactId>hibernate-jpa-2.0-api</artifactId>
	  <version>1.0.1.Final</version>
	</dependency>
	<dependency>
	  <groupId>org.hibernate</groupId>
	  <artifactId>hibernate-ehcache</artifactId>
	  <version>4.1.2</version>
	</dependency>
	<dependency>
	  <groupId>org.hibernate.common</groupId>
	  <artifactId>hibernate-commons-annotations</artifactId>
	  <version>4.0.0.CR2</version>
	</dependency>
	<dependency>
	  <groupId>c3p0</groupId>
	  <artifactId>c3p0</artifactId>
	  <version>0.9.1.2</version>
    </dependency>
    <dependency> 
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.18</version>
    </dependency>
	<!-- hibernate 4.1 end -->
	
	<!-- log4j start -->
	<dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.15</version>
      <!-- 添加一下节点避免maven不兼容 -->
      <exclusions>
        <exclusion>
          <groupId>com.sun.jmx</groupId>
          <artifactId>jmxri</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.jdmk</groupId>
          <artifactId>jmxtools</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.jms</groupId>
          <artifactId>jms</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
	<!-- log4j end -->
    
    <!-- solrj start -->
	<dependency>
	  <groupId>org.apache.solr</groupId>
	  <artifactId>solr-solrj</artifactId>
	  <version>4.9.0</version>
    </dependency>
	<!-- solrj end -->
	
	<!-- apache-poi start -->
	<dependency>
	  <groupId>org.apache.poi</groupId>
	  <artifactId>poi</artifactId>
	  <version>3.7</version>
    </dependency>
    <dependency>
	  <groupId>org.apache.poi</groupId>
	  <artifactId>poi-scratchpad</artifactId>
	  <version>3.7</version>
    </dependency>
    <!-- apache-poi end -->
    
    <!-- org.apache.ant start -->
    <dependency>
	  <groupId>org.apache.ant</groupId>
	  <artifactId>ant</artifactId>
	  <version>1.9.4</version>
    </dependency>
    <!-- org.apache.ant end -->
    
    <!-- fileupload start -->
    <dependency>
	  <groupId>commons-fileupload</groupId>
	  <artifactId>commons-fileupload</artifactId>
	  <version>1.3.1</version>
    </dependency>
    <dependency>
	  <groupId>commons-io</groupId>
	  <artifactId>commons-io</artifactId>
	  <version>2.4</version>
    </dependency>
    <!-- fileupload end -->
    
    <dependency>
      <groupId>javax.annotation</groupId>
      <artifactId>jsr250-api</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-core</artifactId>
      <version>5.7.0</version>
    </dependency>
  </dependencies>

之前我构建好Spring + Hibernate之后程序正常运行
但是当我加入ActiveMQ时发现项目报错
我打开Java Build Path发现这两个jar有问题

然后我去Maven本地仓库查看,发现这两个jar包没有下载下来
http://mvnrepository.com/然后我从mvnrepository上把这两个包下载下来之后加入本地仓库
好了项目没报错了,但是pom.xml文件里面报错,后来在网上找了下解决方案,在pom.xml中加入
<repositories>
    <repository>
        <id>java</id>
        <url>http://download.java.net/maven/2/</url>
        <releases>
           <enabled>true</enabled>
        </releases>
        <snapshots>
          <enabled>false</enabled>
        </snapshots>        
     </repository>
  </repositories>
ok ,问题解决  项目没问题了。

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:3086次
    • 积分:59
    • 等级:
    • 排名:千里之外
    • 原创:2篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条
    文章存档