【问题标题】:ActiveMQ JMS Broker and Spring configurationActiveMQ JMS 代理和 Spring 配置
【发布时间】:2013-08-26 19:00:41
【问题描述】:

我对使用 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

【问题讨论】:

    标签: spring activemq apache-camel


    【解决方案1】:

    Camel 2.11.1 使用 Spring 3.2.3.RELEASE

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

    【讨论】:

      猜你喜欢
      • 2016-01-20
      • 2015-12-13
      • 2016-08-05
      • 2012-10-28
      • 1970-01-01
      • 1970-01-01
      • 2014-08-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多