user2709613
user2709613

Reputation: 71

ActiveMQ JMS Broker and Spring configuration

I'm pretty new to using Camel and ActiveMQ. I'm trying to run a simple code from Eclipse, without using Maven. But, it fails during Bean initialization. From the error, it seems its due to the JAR version differences, but i m failing to locate it. Kindly help me resolve this .

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

Upvotes: 0

Views: 603

Answers (1)

Ben ODay
Ben ODay

Reputation: 21005

Camel 2.11.1 uses Spring 3.2.3.RELEASE

Also, you'll need to have ActiveMQ 5.8.0 jars (activemq-camel, etc) in your path as well to find the org.apache.activemq.camel.component.ActiveMQComponent class

Upvotes: 1

Related Questions