FTP在apache camel中不工作

FTP在apache camel中不工作,ftp,apache-camel,Ftp,Apache Camel,我正在尝试ApacheCamel内置的ftp示例,并与springboot合并。执行这两个命令时,我收到的错误消息不是文件下载。下面是代码片段和日志。从日志中,我可以看到服务器已成功连接,但无法在/tmp/文件夹中看到该文件 2016-03-18 15:21:02.744 INFO 2103 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.16.2 (CamelContext: ca

我正在尝试ApacheCamel内置的ftp示例,并与
springboot
合并。执行这两个命令时,我收到的错误消息不是文件下载。下面是代码片段和日志。从日志中,我可以看到服务器已成功连接,但无法在
/tmp/
文件夹中看到该文件

2016-03-18 15:21:02.744  INFO 2103 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.16.2 (CamelContext: camel-1) is starting
2016-03-18 15:21:02.744  INFO 2103 --- [           main] o.a.c.m.ManagedManagementStrategy        : JMX is enabled
2016-03-18 15:21:02.805  INFO 2103 --- [           main] o.a.c.i.DefaultRuntimeEndpointRegistry   : Runtime endpoint registry is in extended mode gathering usage statistics of all incoming and outgoing endpoints (cache limit: 1000)
2016-03-18 15:21:02.883  INFO 2103 --- [           main] o.a.camel.spring.SpringCamelContext      : AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance.
2016-03-18 15:21:02.883  INFO 2103 --- [           main] o.a.camel.spring.SpringCamelContext      : StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
2016-03-18 15:21:03.711  WARN 2103 --- [           main] o.a.c.c.file.remote.SftpOperations       : JSCH -> Permanently added '**<XXXXXX>**' (RSA) to the list of known hosts.
2016-03-18 15:21:09.025  INFO 2103 --- [           main] o.a.c.c.file.remote.SftpOperations       : Connected to sftp://*****@*****:22
2016-03-18 15:21:09.058  INFO 2103 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: route1 started and consuming from: Endpoint[sftp://******:22/tmp/sample.txt?password=xxxxxx&username=*****]
2016-03-18 15:21:09.059  INFO 2103 --- [           main] o.a.camel.spring.SpringCamelContext      : Total 1 routes, of which 1 is started.
2016-03-18 15:21:09.059  INFO 2103 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.16.2 (CamelContext: camel-1) started in 6.316 seconds
2016-03-18 15:21:09.105  INFO 2103 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-03-18 15:21:09.106  INFO 2103 --- [           main] o.apache.camel.spring.boot.FatJarRouter  : Started FatJarRouter in 10.232 seconds (JVM running for 10.651)
2016-03-18 15:21:02.744信息2103---[main]o.a.camel.spring.SpringCamelContext:apachecamel 2.16.2(CamelContext:camel-1)正在启动
2016-03-18 15:21:02.744信息2103---[main]o.a.c.m.ManagedManagement策略:JMX已启用
2016-03-18 15:21:02.805 INFO 2103---[main]o.a.c.i.DefaultRuntimeEndpointRegistry:运行时端点注册表处于扩展模式,正在收集所有传入和传出端点的使用统计信息(缓存限制:1000)
2016-03-18 15:21:02.883信息2103---[main]o.a.camel.spring.SpringCamelContext:AllowUseOriginalMessage已启用。如果不需要访问原始消息,则建议关闭此选项,因为它可能会提高性能。
2016-03-18 15:21:02.883信息2103---[main]o.a.camel.spring.SpringCamelContext:StreamCaching未被使用。如果使用流,则建议启用流缓存。有关更多详细信息,请参阅http://camel.apache.org/stream-caching.html
2016-03-18 15:21:03.711警告2103---[main]o.a.c.c.file.remote.SftpOperations:JSCH->将“****”(RSA)永久添加到已知主机列表中。
2016-03-18 15:21:09.025信息2103---[main]o.a.c.c.file.remote.sftpo操作:连接到sftp://******@********:22
2016-03-18 15:21:09.058信息2103---[main]o.a.camel.spring.SpringCamelContext:Route:route1开始并从端点使用[sftp://********:22/tmp/sample.txt?密码=xxxxxx和用户名=*****]
2016-03-18 15:21:09.059信息2103---[main]o.a.camel.spring.SpringCamelContext:总共1条路线,其中1条已经开通。
2016-03-18 15:21:09.059 INFO 2103---[main]o.a.camel.spring.SpringCamelContext:apachecamel 2.16.2(CamelContext:camel-1)在6.316秒后启动
2016-03-18 15:21:09.105信息2103---[main]s.b.c.e.t.TomcatEmbeddedServletContainer:Tomcat在端口8080(http)上启动
2016-03-18 15:21:09.106信息2103---[main]o.apache.camel.spring.boot.FatJarRouter:在10.232秒内启动了FatJarRouter(JVM运行10.651)
以及守则:

@SpringBootApplication
public class MySpringBootRouter extends FatJarRouter {

    @Override
    public void configure() throws Exception{

       // configure properties component
       PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
       pc.setLocation("classpath:ftp.properties");

       // lets shutdown faster in case of in-flight messages stack up
       getContext().getShutdownStrategy().setTimeout(10);

       from("sftp://<mylinuxserver>:22/tmp/sample.txt?username=abc&password=123")
            .to("file:/tmp/sample.txt")
            .log("Downloaded file ${file:name} complete.");

       System.out.println("*********************************************************************************");
       // System.out.println("Camel will route files from the FTP server: "
       //        + getContext().resolvePropertyPlaceholders("{{ftp.server}}") + " to the target/download directory.");
       System.out.println("You can configure the location of the ftp server in the src/main/resources/ftp.properties file.");
       System.out.println("Use ctrl + c to stop this application.");
       System.out.println("*********************************************************************************");
    }
}
@springboot应用程序
公共类MySpringBootRouter扩展了FatJarRouter{
@凌驾
public void configure()引发异常{
//配置属性组件
PropertiesComponent pc=getContext().getComponent(“properties”,PropertiesComponent.class);
pc.setLocation(“类路径:ftp.properties”);
//允许在飞行中消息堆积时更快地关机
getContext().getShutdownStrategy().setTimeout(10);
from(“sftp://:22/tmp/sample.txt?username=abc&password=123”)
.to(“文件:/tmp/sample.txt”)
.log(“下载的文件${file:name}已完成”);
System.out.println(“****************************************************************************************************************************************************”);
//System.out.println(“Camel将从FTP服务器路由文件:”
//+getContext().resolvePropertyPlaceholders(“{ftp.server}”)+”到目标/下载目录“);
System.out.println(“您可以在src/main/resources/ftp.properties文件中配置ftp服务器的位置”);
System.out.println(“使用ctrl+c停止此应用程序”);
System.out.println(“****************************************************************************************************************************************************”);
}
}
您可以尝试使用
逐步
选项 和/或
jschLoggingLevel
to
TRACE

还使用Filezilla通过应用程序进行验证

您正在使用的sftp,最好将
ftp
标记交换为
ssh
。日志文件将受益于格式化。