1

I am attempting to SFTP into a remote server and in doing so I am receiving Problem occurred while synchronizing 'download' to local directory

I have attempted changing the remote directory to /, /download, and just download. I have also tried removing some of the other code pieces that I will paste below. Also here is the directory structure of the remote server.

Directory Structure: Directory Structure

    @Bean
    public IntegrationFlow retrieveMarketingMetadata(){
        return IntegrationFlow
                .from(Sftp.inboundAdapter(config.getSftpSessionFactory())
                                .preserveTimestamp(true)
                                .remoteDirectory(sftpProps.getRemoteDirectory())
                                .regexFilter(".*\\.csv$")
                                .localFilenameExpression("#this.toUpperCase() + '.a'") // TODO: Figure out filename
                                .localDirectory(new File("sftp-inbound")),
                        e -> e.id("sftpInboundAdapter")
                                .autoStartup(true)
                                .poller(Pollers.fixedDelay(5000)))
                .handle(m -> log.info("Payload: {}", m.getPayload())) // TODO: Add another handle for Transformation
                .get();
    }

EDIT FULL STACK TRACE:

2023-04-26T09:20:05.183-05:00  WARN 97376 --- [-nio2-thread-11] o.a.s.c.k.AcceptAllServerKeyVerifier     : Server at my.server.com/xx.xx.xx.xxx:22 presented unverified RSA key: SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxx
2023-04-26T09:20:05.786-05:00 ERROR 97376 --- [   scheduling-1] o.s.integration.handler.LoggingHandler   : org.springframework.messaging.MessagingException: Problem occurred while synchronizing '/download' to local directory
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.synchronizeToLocalDirectory(AbstractInboundFileSynchronizer.java:348)
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.doReceive(AbstractInboundFileSynchronizingMessageSource.java:267)
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.doReceive(AbstractInboundFileSynchronizingMessageSource.java:69)
    at org.springframework.integration.endpoint.AbstractFetchLimitingMessageSource.doReceive(AbstractFetchLimitingMessageSource.java:47)
    at org.springframework.integration.endpoint.AbstractMessageSource.receive(AbstractMessageSource.java:142)
    at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:212)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:443)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.pollForMessage(AbstractPollingEndpoint.java:412)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$4(AbstractPollingEndpoint.java:348)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:57)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:55)
    at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$5(AbstractPollingEndpoint.java:341)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:96)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.springframework.messaging.MessagingException: Failed to execute on session
    at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:461)
    at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.synchronizeToLocalDirectory(AbstractInboundFileSynchronizer.java:341)
    ... 20 more
Caused by: org.springframework.integration.util.PoolItemNotAvailableException: Failed to obtain pooled item
    at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:196)
    at org.springframework.integration.file.remote.session.CachingSessionFactory.getSession(CachingSessionFactory.java:134)
    at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:447)
    ... 21 more
Caused by: java.lang.IllegalStateException: failed to create SFTP Session
    at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:291)
    at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:67)
    at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:85)
    at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:82)
    at org.springframework.integration.util.SimplePool.doGetItem(SimplePool.java:206)
    at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:187)
    ... 23 more
Caused by: org.apache.sshd.common.SshException: Application error
    at org.apache.sshd.common.future.AbstractSshFuture.verifyResult(AbstractSshFuture.java:127)
    at org.apache.sshd.client.future.DefaultAuthFuture.verify(DefaultAuthFuture.java:39)
    at org.apache.sshd.client.future.DefaultAuthFuture.verify(DefaultAuthFuture.java:32)
    at org.apache.sshd.common.future.VerifiableFuture.verify(VerifiableFuture.java:43)
    at org.apache.sshd.common.future.VerifiableFuture.verify(VerifiableFuture.java:68)
    at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.initClientSession(DefaultSftpSessionFactory.java:318)
    at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:281)
    ... 28 more
Beez
  • 25
  • 7
  • That `Problem occurred while synchronizing...` comes with a cause. Can we see, please, the whole stack trace for that error? – Artem Bilan Apr 26 '23 at 15:24
  • Yes I will edit the question to include stack trace @ArtemBilan – Beez Apr 26 '23 at 15:51
  • `Caused by: org.apache.sshd.common.SshException: Application error` - not too much. I suggest to consult with your SFTP server to see if there is some cause on its side. `DefaultAuthFuture` - it looks like something might be wrong with your credentials. – Artem Bilan Apr 26 '23 at 16:01
  • I am able to get into the server using FileZilla (See Photo) - however using the Spring Integration Java DSL approach as written above I get the error. I will consult with the vendor and see if they see anything on their side. Thanks – Beez Apr 26 '23 at 16:05
  • 1
    Can you tell us, please, what is the solution? Post that as a answer to your own question to give other community members a clue what to do in similar situation. I make this assumption since I see that you post other questions based on an SFTP channel adapter. Therefore it sounds like an original connection problem has been fixed. – Artem Bilan Jun 14 '23 at 20:06
  • @ArtemBilan - It was on the vendor side of things, therefore placing an answer to my question here doesn't seem like a viable solution. – Beez Jun 27 '23 at 16:26
  • 1
    I’m voting to close this question because the solution is vendor-sensitive. – Artem Bilan Jun 27 '23 at 16:36

0 Answers0