2013-08-26 179 views
0

我是使用Camel和ActiveMQ的新手。我试图从Eclipse运行一个简单的代码,而不使用Maven。但是,它在Bean初始化期间失败。从错误来看,它似乎是由于JAR版本的差异,但我无法找到它。请帮我解决这个问题。ActiveMQ JMS代理和弹簧配置

import org.apache.camel.CamelContext; 
import org.springframework.context.support.AbstractApplicationContext; 
import org.springframework.context.support.ClassPathXmlApplicationContext; 

public class TestingBroker { 

    private TestingBroker() { 
     // Helper class 
    } 

    public static void main(final String[] args) throws Exception { 

     AbstractApplicationContext aContext = new ClassPathXmlApplicationContext(
       "classpath:META-INF/spring/camel-config-client.xml"); 
     CamelContext ctx = (CamelContext) aContext.getBean("mycamelTemplate", CamelContext.class); 
     ctx.addRoutes(new BuildTwitterComponent()); 
     ctx.start(); 
    } 
} 

Here's the camel-config-client.xml file contents- 
<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:camel="http://camel.apache.org/schema/spring" 
     xmlns:context="http://www.springframework.org/schema/context" 
     xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd 
     http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring-2.11.1.xsd"> 

    <camel:camelContext id="my-camel-client"> 
    <camel:template id="mycamelTemplate"/> 
    </camel:camelContext> 

    <bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent"> 
    <property name="brokerURL" value="tcp://135.207.178.237:61616" /> 
    </bean> 

</beans> 

------------------------------ 
I have spring.jar.2.5.6 and camel-spring-2.11.1 JAR in the classpath. Pls suggest what am i missing here. 
Thanks! 
GR 
+0

什么是错误? – techuser

回答

1

骆驼2.11.1使用Spring 3.2.3.RELEASE

此外,你需要拥有的ActiveMQ 5.8.0罐(ActiveMQ的,骆驼等)在您的路径以及寻找org.apache.activemq.camel.component.ActiveMQComponent