0

我对使用 Camel 和 ActiveMQ 很陌生。我正在尝试从 Eclipse 运行一个简单的代码,而不使用 Maven。但是,它在 Bean 初始化期间失败。从错误来看,它似乎是由于 JAR 版本的差异,但我找不到它。请帮我解决这个问题。

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
4

1 回答 1

1

Camel 2.11.1 使用 Spring 3.2.3.RELEASE

此外,您还需要在路径中包含 ActiveMQ 5.8.0 jars(activemq-camel 等)才能找到org.apache.activemq.camel.component.ActiveMQComponent该类

于 2013-08-26T22:11:53.017 回答