2016-12-19 2 views
-1

これが私のメインクラスftpサーバに接続しましたが、Springの統合でファイルがダウンロードされていない人は誰でもこれを修正できますか?

public class FtpInboundChannelAdapterSample { 

private static final Logger LOGGER = LoggerFactory.getLogger(FtpInboundChannelAdapterSample.class); 
public static void main(String[] args) throws Exception { 
    FtpInboundChannelAdapterSample ftp=new FtpInboundChannelAdapterSample(); 
    ftp.ftpDownload(); 



} 

public void ftpDownload() throws Exception { 
    ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext(
      "META-INF/spring/integration/FtpInboundChannelAdapterSample-context.xml"); 

    PollableChannel ftpChannel = ctx.getBean("ftpChannel", PollableChannel.class); 


    System.out.println("Files are transferred "); 
    ctx.close(); 
} 

}

され、

<bean id="ftpClientFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory"> 
    <property name="host" value="${host}"/> 
    <property name="port" value="${availableServerPort}"/> 
    <property name="username" value="${userid}"/> 
    <property name="password" value="${password}"/> 
</bean> 

<int-ftp:inbound-channel-adapter id="ftpInbound" 
      channel="ftpChannel" 
      session-factory="ftpClientFactory" 
      filename-pattern="*.*" 
      auto-create-local-directory="true" 
      delete-remote-files="false" 
      remote-directory="ftp://portal.********.com/foldername/" 
      local-directory="${localDir}"> 
     <int:poller fixed-rate="1000"/> 
</int-ftp:inbound-channel-adapter> 



<int:channel id="ftpChannel"> 
    <int:queue/> 
</int:channel> 

に従うように私の.xmlがあり、これはリモートディレクトリを与えるための方法ですパス?

リモートディレクトリ= "FTP://portal.********.com/foldername/"

又は

リモートディレクトリ= "/ ftpSample /"

私はこれを試してみてください。..

答えて

0

正しい構文はremote-directory="/ftpSample/"ある - 接続はセッションファクトリによって指定されているので、あなたはURLを必要としません。

先頭に/が必要ですか?remote-directory="ftpSample/"ですか?

DEBUGロギングをオンにして、サーバーログもチェックします。

+0

実際に私はサーバーとして考えて、私の同僚のシステムと接続しようとしましたftp接続が確立されており、そのシステムで印刷されたログは以下に与えました – User6375442

+0

別の答え;それを削除し、代わりにあなたの質問を編集する必要があります。また、より良い書式を設定する必要があります。アクセス許可の問題のように見える ''/"の転送のためのデータ接続を開くことができません - スラッシュを削除してください。 –

+0

ありがとうゲーリーファイアウォールやウイルス対策のためだけに許可の問題でした。 – User6375442

0

を両方を試してみましたが、私はそれをダウンロードしたFileZillaのサーバーでローカルホストを使用している場合は、サーバー

からのダウンロードではない:
remote-directory="ftps://portal.********.com/foldername/"または
remote-directory="sftp://portal.********.com/foldername/"

+0

それは動作していません:( – User6375442

関連する問題