2
我第一次玩骆驼。我的试用项目是编写一个接收HTTP GET请求(使用Jetty)的应用程序,并通过Thrift将请求传递给另一个服务器。收到的答案然后传回给客户。 (即我正在编写一个数据交换器或中间件应用程序,如果你将在http-get请求和Thrift服务器之间进行操作)。骆驼与码头
我有非骆驼版本,我现在试图把骆驼相当于一起。目前,我只是试图将码头请求写入文件。
这是我到目前为止有:
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();
}
}
和RouteBuilder:
public class MedicalServiceRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("jetty:http://localhost:8080").to("file://test");
}
}
我目前得到 抛出java.lang.ClassNotFoundException:org.eclipse.jetty.util.component .Destroyable ...我不知道如何解决这个问题。 我应该如何设置,以便我可以接收一个http请求并将其传递给文件?
你的classpath中有jetty-util.jar吗?或者在你的webapps中的WEB-INF/lib /? –
你如何运行你的应用程序?你需要在类路径上有一堆JAR来让它工作。通常使用Maven它可以为你做到这一点。 –