2

I am getting following Error:

java.lang.ClassNotFoundException: org.apache.camel.Component

I am using wildfly server.

My Code is:

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.camel.component.ActiveMQComponent;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;

public class CamelRouter extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        try {

            CamelContext context = new DefaultCamelContext();
            context.addComponent("activemq",ActiveMQComponent.activeMQComponent(ActiveMQConnection.DEFAULT_BROKER_URL));
            context.addRoutes(new RouteBuilder() {
                public void configure() {
                    from("activemq:queue:testMQ").to(
                            "activemq:queue:testMQDestination");
                }
            });

            context.start();
            Thread.sleep(1000);
            context.stop();
            System.out.println("Done");
        } catch (Exception e) {
            System.out.println(e);
        }

    }


}

[Note: I am using plain servlet. No spring, no maven]

Tuhin
  • 3,335
  • 2
  • 16
  • 27
  • Please check your class path. which is missing the camel Component jar. if possible update the question with the activeMQ related jars in your classpath. – Arun Prakash Apr 07 '15 at 11:23

1 Answers1

1

You may want to use the wildfly-camel module for running Apache Camel in WildFly server.

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65
  • Hi claus, thanks for your reply. I am trying to use camel without maven, spring and any other dependency. Please tell me whether any jars need to include in build path. Thanks – Tuhin Apr 07 '15 at 12:32