2016-03-18 34 views
2

Apache deve örneklerini ftp için oluşturdum ve springboot ile birleştirdim. Ne zaman yürütülürken dosya indirme değil bir hata mesajı alıyorum. Aşağıda kod pasajı ve günlükleri bulunur. Sunucudan başarılı bir şekilde bağlandığını görebiliyordum ancak dosyayı /tmp/ klasöründe göremiyorum. FTP apache deve içinde çalışmıyor

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) 

Ve kod:

@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("*********************************************************************************"); 
    } 
} 
+0

Bu * sftp * kullanıyorsunuz, en iyi 'ssh' etiketi için ftp' etiketini kullanın. Günlük dosyası biçimlendirmeden yararlanabilir. –

cevap

0

Bir uygulamayı kullanarak doğrulama için Filezilla ile aynı TRACE

için Stepwise seçeneği ve/veya jschLoggingLevel kullanarak deneyebilirsiniz.