Reputation: 43
I am new to spring. I am using spring to get files from remote server.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
xmlns:sftp="http://www.springframework.org/schema/integration/sftp"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/sftp
http://www.springframework.org/schema/integration/sftp/spring-integration-sftp-2.2.xsd">
<bean id="sftpSessionFactory"
class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="xxxxxxxx" />
<property name="user" value="wildfly" />
<property name="password" value="w!ldfly" />
<property name="port" value="22" />
</bean>
<int:channel id="sftpChannel" />
<sftp:inbound-channel-adapter id="triggerFtpInBound" auto-create-local-directory="true"
local-directory="/tmp/test" filename-pattern="*" channel="sftpChannel"
session-factory="sftpSessionFactory" remote-directory="/home/wildfly" delete-remote-files="true">
<int:poller cron="1/10 * * * * *" max-messages-per-poll="1" />
</sftp:inbound-channel-adapter>
I am using the following code.
ApplicationContext context = new ClassPathXmlApplicationContext("spring/config/spring-sftp.xml");
I am not getting any errors when i run it but i am not getting any files copied either. Please let me know the mistakes in my code. Thanks in advance.
Upvotes: 2
Views: 5335
Reputation: 43
Adding "KnownHosts" property solved my issue. I am getting files transferred now.
<property name="knownHosts" value = "C:\knownhosts"/>
Upvotes: 1
Reputation: 174779
It's difficult to debug just looking at static configuration.
The first step is to turn on DEBUG logging for org.springframework.integration
and see what's happening.
If you can't figure it out from the logs, post them; if too big for here, use a github gist, pastebin, or similar.
Spring Integration uses jsch under the covers; you can enable its logging as described in the reference manual.
Upvotes: 2