簡體   English   中英

未找到使用方案的組件:sftp Apache Camel 2.14.1,ServiceMix 5.2.0

[英]No component found with scheme: sftp Apache Camel 2.14.1, ServiceMix 5.2.0

我一直在與駱駝的FTP組件有很多問題。 我正在使用Apache Camel 2.14.1和Apache ServiceMix 5.2.0

問題是,每當我嘗試進行FTP / SFTP傳輸時都會出現此錯誤:

org.apache.camel.ResolveEndpointFailedException: 
Failed to resolve endpoint: sftp://user@sftp_url/test?binary=true&fileName=destinationFile.txt 
due to: No component found with scheme: sftp

我確保在ServiceMix中正確安裝了必需的組件

karaf@pos-interfaces> list | grep camel-
[ 124] [Active     ] [            ] [       ] [   50] camel-core (2.14.1)
[ 125] [Active     ] [Created     ] [       ] [   50] camel-karaf-commands (2.14.1)
[ 126] [Active     ] [            ] [       ] [   50] camel-jms (2.14.1)
[ 132] [Active     ] [            ] [       ] [   50] camel-spring (2.14.1)
[ 133] [Active     ] [Created     ] [       ] [   50] camel-blueprint (2.14.1)
[ 213] [Active     ] [            ] [       ] [   50] camel-http (2.14.1)
[ 214] [Active     ] [            ] [       ] [   50] camel-jetty (2.14.1)
[ 271] [Active     ] [            ] [       ] [   50] camel-exec (2.14.1)
[ 285] [Active     ] [            ] [       ] [   50] camel-quartz2 (2.14.1)
[ 287] [Active     ] [            ] [       ] [   90] camel-jaxb (2.14.1)
[ 572] [Active     ] [            ] [       ] [   50] camel-ftp (2.14.1)
[ 573] [Active     ] [            ] [       ] [   50] camel-jsch (2.14.1)

我什至還添加了一些代碼來檢查“ ftp / sftp”組件是否已在上下文中並且已啟動(如果沒有,我會強制啟動)。 這是日志中顯示的內容:

| DEBUG | xtenderThread-56 | RouteBuilder      | ? | sftp component already there...
| DEBUG | xtenderThread-56 | RouteBuilder      | ? | sftp original status...Stopped
| DEBUG | xtenderThread-56 | RouteBuilder      | ? | sftp starting manually...
| DEBUG | xtenderThread-56 | RouteBuilder      | ? | final sftp status...Started

但是,我仍然遇到錯誤...

我發現這篇文章的問題與我的駱駝沒有在注冊表中找到“ sftp”組件並關閉有關 ,並且他們說使用OsgiDefaultCamelContext解決了該問題,但是我認為我們不能使用它,因為使用SpringCamelContext …或至少我沒有找到任何文檔/示例來更改spring-context.xml中的CamelContext類

你能請教嗎? 提前致謝。

[更新]終於完成了這項工作! 問題是我這樣聲明了模板:

producerTemplate = getContext().createProducerTemplate();

這樣,就沒有設置OSGI並發生了錯誤。 但是,然后我用以下命令更新了camel-context.xml:

<camelContext trace="false" id="camelContext"
    xmlns="http://camel.apache.org/schema/spring">
    <template id="producerTemplate"/>
    <routeBuilder ref="routeBuilder" />
</camelContext>

和我的路線建設者與此:

@BeanInject("producerTemplate")
private transient ProducerTemplate producerTemplate;

瞧! 有效!

希望這對某人有幫助!

終於做好了這項工作! 問題是我這樣聲明了模板:

producerTemplate = getContext().createProducerTemplate();

這樣,就沒有設置OSGI並發生了錯誤。 但是,然后我用以下命令更新了camel-context.xml:

<camelContext trace="false" id="camelContext"
    xmlns="http://camel.apache.org/schema/spring">
    <template id="producerTemplate"/>
    <routeBuilder ref="routeBuilder" />
</camelContext>

和我的路線建設者與此:

@BeanInject("producerTemplate")
private transient ProducerTemplate producerTemplate;

瞧! 有效!

希望這對某人有幫助!

暫無
暫無

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

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