首页 > 解决方案 > 将嵌入式码头与 camel-cxf 结合使用

问题描述

我在我的 Camel 项目中定义了几条休息路线,现在我正在尝试使用相同的码头嵌入式服务器向我的项目添加 SOAP 服务。

我有这样的事情:

restConfiguration()
    .component("jetty")
    .host("0.0.0.0")
    .port(8080)
;

CxfEndpoint cxfEndpoint = new CxfEndpoint();
cxfEndpoint.setCamelContext(getContext());
cxfEndpoint.setServiceClass(TestService.class);
cxfEndpoint.setAddress("http://0.0.0.0:8080/test");

from(cxfEndpoint)
    .log(LoggingLevel.INFO, log, "test");

当我尝试运行应用程序时,我收到以下错误消息:

Web 服务器无法启动。端口 8080 已被使用。

看起来它正在尝试使用相同的端口启动 2 个 Jetty 实例,这就是它失败的原因。

我真的很想让 cxf 端点与用于我的其他服务的嵌入式 Jetty 一起工作。有没有办法做到这一点?

标签: apache-camel

解决方案


推荐阅读