2017-05-18 65 views
0
<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:amq="http://activemq.apache.org/schema/core" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:jee="http://www.springframework.org/schema/jee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:tx="http://www.springframework.org/schema/tx" 
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd 
http://activemq.apache.org/schema/core 
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd 
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context.xsd 
http://www.springframework.org/schema/jms 
http://www.springframework.org/schema/jms/spring-jms.xsd 
http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx.xsd 
http://www.springframework.org/schema/jee 
http://www.springframework.org/schema/jee/spring-jee-3.0.xsd"> 

    <!-- Activemq connection factory --> 
    <!-- <bean id="amqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
     <constructor-arg index="0" value="tcp://localhost:61616"/> 
    </bean> --> 

<jee:jndi-lookup id="amqConnectionFactory" jndi-name="java:/activemq/ConnectionFactoryAVT" /> 
<jee:jndi-lookup id="tripQueue" jndi-name="java:/activemq/queue_trip" /> 
    <!-- ConnectionFactory Definition --> 
    <bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"> 
     <constructor-arg ref="amqConnectionFactory" /> 
    </bean> 

    <!-- Default Destination Queue Definition--> 
    <bean id="defaultDestination" class="org.apache.activemq.command.ActiveMQQueue"> 
     <constructor-arg index="0" value="queue.trip"/> 
    </bean> 

    <!-- JmsTemplate Definition --> 
    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"> 
     <property name="connectionFactory" ref="connectionFactory" /> 
     <property name="defaultDestination" ref="tripQueue" /> 
    </bean> 

     <!-- Message Sender Definition --> 
    <bean id="messageSender" class="com.proxy.vcg.b.beans.JMSQueueSenderForTrip" /> 

<context:component-scan base-package="com.proxy.vcg"></context:component-scan> 
</beans> 

這是JMS ActiveMQ簡單spring java項目的bean配置xml。 雖然部署我得到下面的異常和部署失敗,我使用JBoss 6.1和我使用Spring版本3.找不到類[org.apache.activemq.command.ActiveMQQueue]

Context initialization failed: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.activemq.command.ActiveMQQueue] for bean with name 'defaultDestination' defined in URL [vfs:/C:/Tools/jboss-eap-6.1.0/jboss-eap-6.1/bin/content/RestGateway.war/WEB-INF/lib/Proxy-7.0.jar/jmsTrip.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.activemq.command.ActiveMQQueue from [Module "deployment.RestGateway.war:main" from Service Module Loader] 

任何幫助嗎?非常感謝!!!

以下是我的pom.xml

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>com.fish.net</groupId> 
    <artifactId>AV</artifactId> 
    <name>AVTWER</name> 
    <version>7.0</version> 
    <packaging>pom</packaging> 

    <modules> 

     <module>RestGateway</module> 
     <module>Proxy</module> 


    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.5.1</version> 
       <configuration> 
        <source>1.7</source> 
        <target>1.7</target> 
       </configuration> 
      </plugin> 

     </plugins> 
    </build> 




    <dependencyManagement> 
     <dependencies> 
      <!-- Test dependencies that might be used by children --> 

     </dependencies> 
    </dependencyManagement> 

    <dependencies> 

     <dependency> 
      <groupId>org.apache.tomcat</groupId> 
      <artifactId>catalina</artifactId> 
      <version>6.0.43</version> 
     </dependency> 

     <!-- JavaEE compile-time dependencies --> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>servlet-api</artifactId> 
      <version>2.4</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet.jsp</groupId> 
      <artifactId>jsp-api</artifactId> 
      <version>2.0</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>javax.annotation</groupId> 
      <artifactId>jsr250-api</artifactId> 
      <version>1.0</version> 

     </dependency> 
     <dependency> 
      <groupId>javax.ejb</groupId> 
      <artifactId>ejb-api</artifactId> 
      <version>3.0</version> 

     </dependency> 
     <!-- <dependency> <groupId>javax.persistence</groupId> <artifactId>persistence-api</artifactId> 
      <version>1.0b</version> </dependency> --> 

     <dependency> 
      <groupId>javax.transaction</groupId> 
      <artifactId>jta</artifactId> 
      <version>1.1</version> 

     </dependency> 
     <dependency> 
      <groupId>javax.inject</groupId> 
      <artifactId>javax.inject</artifactId> 
      <version>1</version> 
     </dependency> 
     <dependency> 
      <groupId>javax.xml.bind</groupId> 
      <artifactId>jaxb-api</artifactId> 
      <version>2.1</version> 
     </dependency> 

     <!-- Test dependencies --> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-test</artifactId> 
      <version>${spring.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.dbunit</groupId> 
      <artifactId>dbunit</artifactId> 
      <version>2.4.9</version> 
      <exclusions> 
       <exclusion> 
        <artifactId>slf4j-api</artifactId> 
        <groupId>org.slf4j</groupId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
     <dependency> 
      <groupId>org.hsqldb</groupId> 
      <artifactId>hsqldb</artifactId> 
      <version>2.3.1</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-logging</groupId> 
      <artifactId>commons-logging</artifactId> 
      <version>1.1.1</version> 
      <scope>test</scope> 
     </dependency> 


     <!-- <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> 
      <version>4.8.1</version> <scope>test</scope> </dependency> --> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.11</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.hamcrest</groupId> 
      <artifactId>hamcrest-all</artifactId> 
      <version>1.1</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.mockito</groupId> 
      <artifactId>mockito-all</artifactId> 
      <version>1.8.5</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>xmlunit</groupId> 
      <artifactId>xmlunit</artifactId> 
      <version>1.3</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>commons-dbcp</groupId> 
      <artifactId>commons-dbcp</artifactId> 
      <version>1.2.2</version> 
     </dependency> 

     <dependency> 
      <groupId>cglib</groupId> 
      <artifactId>cglib</artifactId> 
      <version>2.2.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      <version>4.2.11.Final</version> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-c3p0</artifactId> 
      <version>4.2.11.Final</version> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-validator</artifactId> 
      <version>4.1.0.Final</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>javassist</groupId> 
      <artifactId>javassist</artifactId> 
      <version>3.12.1.GA</version> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-entitymanager</artifactId> 
      <version>4.2.11.Final</version> 
     </dependency> 
       <dependency> 
         <groupId>org.hibernate</groupId> 
         <artifactId>hibernate-envers</artifactId> 
         <version>4.2.11.Final</version> 
       </dependency> 
     <dependency> 
      <groupId>org.apache.activemq</groupId> 
      <artifactId>activemq-all</artifactId> 
      <version>5.6.0</version> 
      <scope>provided</scope> 
     </dependency> 

     <!-- Spring --> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-jms</artifactId> 
      <version>3.2.3.RELEASE</version> 
      <scope>compile</scope> 
      <exclusions> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-core</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-aop</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-asm</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-orm</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-web</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-beans</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-tx</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-context</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-orm</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-beans</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-asm</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-context</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-context-support</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-web</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-core</artifactId> 
      <version>${spring.version}</version> 
      <exclusions> 
       <exclusion> 
        <artifactId>commons-logging</artifactId> 
        <groupId>commons-logging</groupId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
     <!-- Spring --> 



     <dependency> 
      <groupId>com.sun.jersey.contribs</groupId> 
      <artifactId>jersey-spring</artifactId> 
      <version>1.8</version> 
      <exclusions> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-core</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-aop</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-asm</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-orm</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-web</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-beans</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-context</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 


     <dependency> 
      <groupId>com.sun.jersey.contribs</groupId> 
      <artifactId>jersey-multipart</artifactId> 
      <version>1.8</version> 
     </dependency> 


     <dependency> 
      <groupId>xerces</groupId> 
      <artifactId>xercesImpl</artifactId> 
      <version>2.10.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.velocity</groupId> 
      <artifactId>velocity</artifactId> 
      <version>1.7</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>poi</artifactId> 
      <version>3.9</version> 
     </dependency> 

     <dependency> 
      <groupId>com.ibm</groupId> 
      <artifactId>wmq-jmsra</artifactId> 
      <version>7.0.1.9-reconnect-configured</version> 
     </dependency> 

     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-api</artifactId> 
      <version>${slf4j.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>ch.qos.logback</groupId> 
      <artifactId>logback-classic</artifactId> 
      <version>1.0.13</version> 
     </dependency> 

     <dependency> 
      <groupId>javax.jms</groupId> 
      <artifactId>javax.jms-api</artifactId> 
      <version>2.0.1</version> 
     </dependency> 

     <dependency> 
      <groupId>org.liquibase</groupId> 
      <artifactId>liquibase-core</artifactId> 
      <version>3.2.0</version> 
     </dependency> 

     <dependency> 
      <groupId>postgresql</groupId> 
      <artifactId>postgresql</artifactId> 
      <version>9.1-901.jdbc4</version> 
     </dependency> 


     <dependency> 
      <groupId>joda-time</groupId> 
      <artifactId>joda-time</artifactId> 
      <version>2.3</version> 
     </dependency> 
     <!-- Graphite Monitoring --> 
     <dependency> 
      <groupId>com.wirelesscar.statistics</groupId> 
      <artifactId>statistics-base</artifactId> 
      <version>1.0.1</version> 
     </dependency> 
     <!-- Quartz job scheduler --> 
     <dependency> 
      <groupId>org.quartz-scheduler</groupId> 
      <artifactId>quartz</artifactId> 
      <version>1.8.5</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-logging</groupId> 
      <artifactId>commons-logging</artifactId> 
      <version>1.1.1</version> 
      <scope>test</scope> 
     </dependency> 

     <dependency> 
      <groupId>aspectj</groupId> 
      <artifactId>aspectjrt</artifactId> 
      <version>1.5.4</version> 
     </dependency> 

     <dependency> 
      <groupId>aspectj</groupId> 
      <artifactId>aspectjweaver</artifactId> 
      <version>1.5.4</version> 
     </dependency> 

     <dependency> 
      <groupId>org.ini4j</groupId> 
      <artifactId>ini4j</artifactId> 
      <version>0.3.3</version> 
     </dependency> 

     <dependency> 
      <groupId>commons-configuration</groupId> 
      <artifactId>commons-configuration</artifactId> 
      <version>1.6</version> 
     </dependency> 
     <dependency> 
      <groupId>com.volvo.vgt.avt.map.component</groupId> 
      <artifactId>mapcomponent</artifactId> 
      <version>27</version> 
     </dependency> 
     <dependency> 
      <groupId>com.h2database</groupId> 
      <artifactId>h2</artifactId> 
      <version>1.4.181</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-validator</groupId> 
      <artifactId>commons-validator</artifactId> 
      <version>1.4.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.google.code.gson</groupId> 
      <artifactId>gson</artifactId> 
      <version>1.4</version> 
     </dependency> 

     <dependency> 
      <groupId>com.wordnik</groupId> 
      <artifactId>swagger-jersey2-jaxrs_2.10</artifactId> 
      <version>1.3.8</version> 
      <exclusions> 
       <exclusion> 
        <groupId>org.glassfish.jersey.core</groupId> 
        <artifactId>jersey-client</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>org.glassfish.jersey.core</groupId> 
        <artifactId>jersey-server</artifactId> 
       </exclusion> 
       <!-- <exclusion> <artifactId>jersey-media-multipart</artifactId> </exclusion> 
        <exclusion> <artifactId>jersey-container-servlet-core</artifactId> </exclusion> --> 
      </exclusions> 
     </dependency> 

    </dependencies> 

    <properties> 
     <atomikos.version>3.8.0</atomikos.version> 
     <spring.version>3.1.2.RELEASE</spring.version> 
     <derby.version>10.8.1.2</derby.version> 
     <el.version>1.0</el.version> 
     <slf4j.version>1.7.1</slf4j.version> 
     <main.basedir>${project.parent.basedir}</main.basedir> 
    </properties> 

</project> 
+1

請分享您使用的pom.xml或jar列表。也許你必須添加包含缺失類的適當的依賴項/庫。 – Francesco

+0

@Francesco我已添加我的pom.xml –

+0

@Francesco這也工作了! –

回答

0

provided更改activemq-all依賴範圍compile(或刪除範圍標記)與你在你的WEB-INF/lib錯過類的.jar。

+0

謝謝@Francesco –

0
<dependency> 
<groupId>org.apache.activemq</groupId> 
<artifactId>activemq-broker</artifactId> 
<version>5.14.0</version> 
</dependency> 

添加這種相關性爲我工作!