首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >sftp Apache 2.14.1,ServiceMix 5.2.0

sftp Apache 2.14.1,ServiceMix 5.2.0
EN

Stack Overflow用户
提问于 2015-09-10 16:01:43
回答 1查看 1.6K关注 0票数 2

我在Camel的FTP组件上有很多问题。我使用Apache 2.14.1和Apache 5.2.0

问题是,每当我尝试执行FTP/SFTP传输时,都会得到此错误:

代码语言:javascript
复制
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中正确安装了所需的组件

代码语言:javascript
复制
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”组件是否已经在上下文中并已启动(如果不是,我会强制启动它)。这就是日志中打印的内容:

代码语言:javascript
复制
| 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

但是,我还是会犯错误.

我发现这篇文章与我的Camel not finding "sftp" component in registry and shutting down有类似的问题,他们说使用OsgiDefaultCamelContext解决了问题,但我不认为我们可以使用它,因为我们使用的是SpringCamelContext…或者至少我还没有找到任何文档/示例来更改Springcontext.xml中的CamelContext类。

你能给我个建议吗?提前谢谢。

更新终于使这个工作!问题是,我这样声明模板:

代码语言:javascript
复制
producerTemplate = getContext().createProducerTemplate();

这样,OSGI就没有被设置,错误就发生了。但是,我用以下内容更新了camel-context.xml:

代码语言:javascript
复制
<camelContext trace="false" id="camelContext"
    xmlns="http://camel.apache.org/schema/spring">
    <template id="producerTemplate"/>
    <routeBuilder ref="routeBuilder" />
</camelContext>

我的航路建设者说:

代码语言:javascript
复制
@BeanInject("producerTemplate")
private transient ProducerTemplate producerTemplate;

还有哇!啊,真灵!

希望这能帮到别人!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-08-23 14:36:39

终于成功了!问题是,我这样声明模板:

代码语言:javascript
复制
producerTemplate = getContext().createProducerTemplate();

这样,OSGI就没有被设置,错误就发生了。但是,我用以下内容更新了camel-context.xml:

代码语言:javascript
复制
<camelContext trace="false" id="camelContext"
    xmlns="http://camel.apache.org/schema/spring">
    <template id="producerTemplate"/>
    <routeBuilder ref="routeBuilder" />
</camelContext>

我的航路建设者说:

代码语言:javascript
复制
@BeanInject("producerTemplate")
private transient ProducerTemplate producerTemplate;

还有哇!啊,真灵!

希望这能帮到别人!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32506674

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档