Camel sftp写入文件失败:无法存储文件

时间:2017-04-24 16:20:44

标签: java apache-camel sftp jms-topic camel-ftp

我有几天,看看apache Camel并通过sftp服务器将文件传输到jms队列或主题。

我在配置端点(消费者),路由(从文件到sftp,从sftp到jms .....)的层面上遇到了问题。没有什么对我有用。 我在sftp服务器(linux),java版本“1.7.0_45”上工作 我使用apache camel 2.5,activemq 5.3.2, 我上传了Jsch jar,

这是我的简单代码

public class FtpJms {

    public static void main(String args[]) throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(new RouteBuilder() {
             @Override
            public void configure() {

            from("file://usr/dir1/dir2?noop=true").
            to("sftp://root@hostname/inbox?username=root&password=xxx");
        }});

我将程序打包到一个jar文件中,然后,我在服务器上运行它。 但是,它返回:

[ - file://usr/dir1/dir2] SftpOperations                 INFO  JSCH -> Authentications that can continue: password
[ - file://usr/dir1/dir2] SftpOperations                 INFO  JSCH -> Next authentication method: password
[ - file://usr/dir1/dir2] SftpOperations                 INFO  JSCH -> Authentication succeeded (password).
[ - file://usr/dir1/dir2] SftpOperations                 INFO  Connected to sftp://root@hostname:22
[ - file://usr/dir1/dir2] RemoteFileProducer             INFO  Connected and logged in to: Endpoint[sftp://root@hostname/inbox?password=******&username=root]
[ - file://usr/dir1/dir2] RemoteFileProducer             WARN  Writing file failed with: Cannot store file: inbox/test10.txt
[ - file://usr/dir1/dir2] SftpOperations                 INFO  JSCH -> Disconnecting from hostname port 22
[ - file://usr/dir1/dir2] GenericFileOnCompletion        ERROR Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot store file: inbox/test10.txt]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot store file: inbox/test10.txt
        at org.apache.camel.component.file.remote.SftpOperations.storeFile(SftpOperations.java:617)[jar:rsrc:camel-ftp-2.5.0.jar!/:]
        at org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:220)[jar:rsrc:camel-core-2.5.0.jar!/:]
        at org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:138)[jar:rsrc:camel-core-2.5.0.jar!/:]
        at org.apache.camel.component.file.remote.RemoteFileProducer.process(RemoteFileProducer.java:49)[jar:rsrc:camel-ftp-2.5.0.jar!/:]
        at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)[jar:rsrc:camel-core-2.5.0.jar!/:]

0 个答案:

没有答案