Java 部署为war时SFTP入站同步失败
spring boot应用程序将文件从远程sftp服务器复制到网络上的共享位置 它在intellij内部的嵌入式tomcat服务器上运行良好,但在作为war部署到服务器时失败,并显示以下消息Java 部署为war时SFTP入站同步失败,java,spring,spring-boot,sftp,Java,Spring,Spring Boot,Sftp,spring boot应用程序将文件从远程sftp服务器复制到网络上的共享位置 它在intellij内部的嵌入式tomcat服务器上运行良好,但在作为war部署到服务器时失败,并显示以下消息 Caused by: java.io.FileNotFoundException: sharedfolder at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMes
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=“fromstpchannel1”,poller=@poller(cron=“${sftp.cronExpression}”))
public MessageSource sftpMessageXMLSource(){
SftpInboundFileSynchronizingMessageSource=新的SftpInboundFileSynchronizingMessageSource(
sftpInboundFileSynchronizerXML());
log.info(“本地目录:+新文件(sftpLocalDirectoryDownloadXML));
setLocalDirectory(新文件(sftpLocalDirectoryDownloadXML));
source.setAutoCreateLocalDirectory(false);
setLocalFilter(新的AcceptOnceFileListFilter());
返回源;
}
此处的信息不多,但似乎“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;
}