簡體   English   中英

Apache Camel:從駱駝tomcat servlet到cxfbean組件的路由

[英]Apache Camel: Route from camel tomcat servlet to cxfbean component

問題描述:我無法從駱駝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組件 ,而不是Camel Cxf Bean

我要實現的目標:我正在Tomcat中運行駱駝servlet。 我有一個實現我的Web服務接口(由CXF從WSDL生成)的bean。 我想先處理XML消息正文,然后再將其傳遞到此Webservice Bean。 我想使用cxf bean組件而不是cxf端點bean,因為除了已經運行的駱駝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格式在上面的代碼定義在這里

我的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描述中的文檔,並遵循stackoverflow。 我希望我的問題不會輕易回答,我是駱駝的新手。

非常感謝您的想法

如果要使用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");
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM