2
votes

I am playing around with Camel for the first time. My trial project is to write an application that receives an HTTP GET request (using Jetty) and passes on the request via Thrift to another server. The answer received is then passed back to the client. (i.e. I'm writing a data switch or a middleware application if you will between an http-get request and a Thrift-enanbled server.)

I have the non-camel version perfectly and I am now trying to put the camel-equivalent together. For now I am only trying to get the jetty request written to a file.

This is what I have so far:

public class CamelMedicalService {

    public static void main(String[] args) throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(new MedicalServiceRouteBuilder());
        context.start();

        // Wait a minute and then stop all.
        Thread.sleep(TimeUnit.MINUTES.toMillis(1));
        context.stop();
    }
} 

and the RouteBuilder:

public class MedicalServiceRouteBuilder extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        from("jetty:http://localhost:8080").to("file://test");
    }
}

I am currently getting java.lang.ClassNotFoundException: org.eclipse.jetty.util.component.Destroyable... I am not sure how to resolve this. How should I set this up so that I can receive an http request and pass it to the file?

1
Do you have the jetty-util.jar in your classpath? or in your webapps WEB-INF/lib/?Joakim Erdfelt
How do you run your application? You need to have a bunch of JARs on the classpath to have it working. Usually with Maven it can do this for you.Claus Ibsen

1 Answers

0
votes

Like in the comments, please check if jetty-util.jar is in the classpath, if not, you can copy it to your WEB-INF/lib directory.