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;
}