部署为War时,SFTP入站同步失败

时间:2019-09-04 15:12:50

标签: java spring spring-boot sftp

Spring Boot应用程序将文件从远程sftp服务器复制到网络上的共享位置

它可以与我在Intellij中的嵌入式tomcat服务器正常工作,但是当通过以下消息作为战争部署到服务器时失败

Caused by: java.io.FileNotFoundException: sharedfolder
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.onInit(AbstractInboundFileSynchronizingMessageSource.java:187)
    ... 72 more

这是代码

属性文件

sftp.local.directory.xml.download=\\\\somename\\\parentfolder\\sharedfolder

同步

@Bean
@InboundChannelAdapter(channel = "fromSftpChannel1", poller = @Poller(cron = "${sftp.cronExpression}"))
public MessageSource<File> sftpMessageXMLSource() {
    SftpInboundFileSynchronizingMessageSource source = new SftpInboundFileSynchronizingMessageSource(
            sftpInboundFileSynchronizerXML());

    log.info("Local dir: " + new File(sftpLocalDirectoryDownloadXML));
    source.setLocalDirectory(new File(sftpLocalDirectoryDownloadXML));
    source.setAutoCreateLocalDirectory(false);
    source.setLocalFilter(new AcceptOnceFileListFilter<File>());
    return source;
}

0 个答案:

没有答案