>> To[c-6ren">
gpt4 book ai didi

apache-camel - Apache Camel : Route from camel tomcat servlet to cxfbean component

转载 作者:行者123 更新时间:2023-12-01 06:51:02 30 4
gpt4 key购买 nike

问题描述:
我无法从我的 Camel servlet 路由到 cxfbean。路由初始化失败并显示以下错误消息:

"Failed to create route route1 at: >>> To[cxfbean:fooEndpoint] <<< in route:
Route[[From[servlet:///?servletName=BwsServlet]] -> [To[cxfb... because of Failed to resolve
endpoint: cxfbean://fooEndpoint due to: null".

没有 cxfbean 的 servlet 可以正常启动。

更新 : 请注意,我打算使用 Camel Cxf Bean Component而不是 Camel Cxf Bean .

我要达到的目标:
我在 Tomcat 中运行 Camel servlet。我有一个实现我的 web 服务接口(interface)的 bean(由 CXF 从 WSDL 生成)。我想在将 XML 消息体传递给这个 webservice bean 之前对其进行处理。我想使用 cxf bean 组件而不是 cxf 端点 bean,因为除了已经运行的 Camel servlet 之外,我不想让我的 cxf 端点在网络端口上监听。

我的代码是什么样子的:
我的 camel-config.xml 看起来像这样:
<bean id="bwsRouteBuilder" class="local.com.foo.BwsRouteBuilder"/>
<bean id="fooEndpoint" class="local.com.foo.FooBws"/>
<camel:camelContext id="bws">
<camel:routeBuilder ref="bwsRouteBuilder"/>
</camel:camelContext>

我的路由构建器(用 Java DSL 编写)如下所示:
public void configure() throws Exception {
from("servlet:///?servletName=BwsServlet")
// some processing of message here
.to("cxfbean:fooEndpoint");
}

更新 : 注意上面代码中定义的 cxfbean URI 格式 here .

我的 web.xml 看起来像这样:
<servlet>
<servlet-name>BwsServlet</servlet-name>
<servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>BwsServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

camel-cxf 作为依赖项包含在我的 pom.xml 中。

到目前为止我在哪里寻求帮助:我正在关注 Apache Camel cxfbean description 上的文档并遵循stackoverflow。我希望我的问题不是很容易回答,我是 Camel 的新手。

非常感谢您的想法

最佳答案

如果你想使用 cxf bean,你必须在你的路由中写“cxf:bean:fooEndpoint”(你忘记了:在 cxf 和 bean 之间)。

public void configure() throws Exception {
from("servlet:///?servletName=BwsServlet")
// some processing of message here
.to("cxf:bean:fooEndpoint");
}

关于apache-camel - Apache Camel : Route from camel tomcat servlet to cxfbean component,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12144717/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com