Announcement Announcement Module
Collapse
No announcement yet.
FTP Connection Problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • FTP Connection Problem

    Hi,

    I am trying to ftp using Spring Integration scheduler and i am getting following error


    Code:
    Caused by: org.springframework.integration.MessagingException: Failed to write to '/Test/output/MW01_0510_20120709.txt/MW01_0510_20120709.txt.writing' while uploading the file
    	at org.springframework.integration.file.remote.handler.FileTransferringMessageHandler.sendFileToRemoteDirectory(FileTransferringMessageHandler.java:227)
    	at org.springframework.integration.file.remote.handler.FileTransferringMessageHandler.handleMessageInternal(FileTransferringMessageHandler.java:136)
    	... 36 more
    Caused by: java.io.IOException: Failed to write to '/Test/output/MW01_0510_20120709.txt.writing'. Server replied with: 425      No data connection
    
    	at org.springframework.integration.ftp.session.FtpSession.write(FtpSession.java:81)
    	at org.springframework.integration.file.remote.handler.FileTransferringMessageHandler.sendFileToRemoteDirectory(FileTransferringMessageHandler.java:222)
    	... 37 more
    I tried to put a file through ftp client and it was copied successfully but through code it is giving me error.

    Please provide some solution.

    --
    Thanks and Regards
    Karan

  • #2
    Can you please include your configuration?
    Also, have you looked at the FTP sample https://github.com/SpringSource/spri...ter/basic/ftp?

    Comment


    • #3
      Originally posted by oleg.zhurakousky View Post
      Can you please include your configuration?
      Also, have you looked at the FTP sample https://github.com/SpringSource/spri...ter/basic/ftp?
      Hi

      Please find my ftp-config.xml as below

      Code:
      <?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:int-ftp="http://www.springframework.org/schema/integration/ftp"
      	xmlns:int-sftp="http://www.springframework.org/schema/integration/sftp"
      	xsi:schemaLocation="
      	http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.1.xsd
      	http://www.springframework.org/schema/integration/sftp http://www.springframework.org/schema/integration/sftp/spring-integration-sftp-2.1.xsd
      		http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.1.xsd
      		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
      
      	<int:channel id="splitterChannel" />
      	<int:channel id="ftpChannel" />
      	<int:channel id="ftplsChannel" />
      	
      
      	<int:splitter input-channel="splitterChannel"
      		output-channel="ftpChannel" />
      
      	
      				
      	<!-- FTP configuration -->
      	<int-ftp:outbound-channel-adapter id="ftpOutbound"
      		cache-sessions="false" channel="ftpChannel" remote-directory="/test-ftp/"
      		session-factory="ftpClientFactory" />
      
      	<int-ftp:outbound-gateway command="ls"
      		session-factory="ftpClientFactory" expression="payload"
      		request-channel="ftplsChannel"/>
      		
      	<int:gateway id="ftpGateway" default-request-channel="ftplsChannel"
      		service-interface="com.test.scheduler.ftp.ToFtpGateway" />
      
      
      	<bean id="ftpClientFactory"
      		class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
      		<property name="host" value="home.site.mysite.net" />
      		<property name="port" value="21" />
      		<property name="username" value="guest_user" />
      		<property name="password" value="welcome" />
      	</bean>
      
      
      </beans>

      Comment


      • #4
        Can you please read this and investigate some of your server configurations? http://geekswithblogs.net/Lance/arch...tion.quot.aspx

        Comment


        • #5
          Hi ,

          Can we set an active mode configuration explicitly in outbound-channel-adapter like in

          <int-ftp:outbound-channel-adapter id="ftpOutbound"
          cache-sessions="false" channel="ftpChannel" remote-directory="/test-ftp/"
          session-factory="ftpClientFactory" />
          or can you please provide some help for identifying ftp is in which mode ? and also how to change mode from passive to active mode for ftp client.

          Comment


          • #6
            Hi ,

            Can we set an active mode configuration explicitly in outbound-channel-adapter like in

            <int-ftp:outbound-channel-adapter id="ftpOutbound"
            cache-sessions="false" channel="ftpChannel" remote-directory="/test-ftp/"
            session-factory="ftpClientFactory" />
            or can you please provide some help for identifying ftp is in which mode ? and also how to change mode from passive to active mode for ftp client.

            Comment


            • #7
              Active mode is set by default in DefaultFtpSessionFactory and there is a corresponding property exposed for that.
              Code:
              public void setClientMode(int clientMode) {...}
              . . . so you can set it during session factory configuration:
              http://static.springsource.org/sprin...lientMode(int)

              Comment


              • #8
                I have changed my configuration from

                <bean id="ftpClientFactory"
                class="org.springframework.integration.ftp.session .DefaultFtpSessionFactory">
                <property name="host" value="home.site.mysite.net" />
                <property name="port" value="21" />
                <property name="username" value="guest_user" />
                <property name="password" value="welcome" />
                </bean>
                to

                <bean id="ftpClientFactory"
                class="org.springframework.integration.ftp.session .DefaultFtpSessionFactory">
                <property name="host" value="home.site.mysite.net" />
                <property name="port" value="21" />
                <property name="username" value="guest_user" />
                <property name="password" value="welcome" />
                <property name="clientMode" value="0" />
                </bean>
                but still it is giving me the same exception as

                Caused by: org.springframework.integration.MessagingException : Failed to write to '/Test/output/MW01_0510_20120709.txt/MW01_0510_20120709.txt.writing' while uploading the file
                at org.springframework.integration.file.remote.handle r.FileTransferringMessageHandler.sendFileToRemoteD irectory(FileTransferringMessageHandler.java:227)
                at org.springframework.integration.file.remote.handle r.FileTransferringMessageHandler.handleMessageInte rnal(FileTransferringMessageHandler.java:136)
                ... 36 more
                Caused by: java.io.IOException: Failed to write to '/Test/output/MW01_0510_20120709.txt.writing'. Server replied with: 425 No data connection

                Comment


                • #9
                  hi,

                  What could be the problem here.
                  It shows me a file in the specified location, but it is not allowed to write the whole file.
                  Changed to active mode also, but dint work.

                  Comment


                  • #10
                    What FTP server you are using? What is the OS etc...

                    Also, please do some research as to the origin of 425 specific to your environment (talk to your network administrators etc.). As you can see the error is clearly not Spring Integration related. If at some point you discover that there is a setting that is missing, we would definitely do our best to make it work, but at this point it is just a guessing game and you are the only one tat has access to your environment to debug.

                    Comment


                    • #11
                      Hi,

                      We are using cent OS for ftp client and Ubuntu for ftp server. Also we have open port 21 on both machines in iptables.
                      Do we need to open port 20 also on both the machines? Because i found that FTP port is the 'command port' which utilizes the communication between the FTP server and the FTP client. The second port is the 'data transfer' port where the real file transfer runs. Typically, the command port is set to port 21 and the data transfer port is port 20.

                      Referred from :- http://www.ntchosting.com/ftp/ftp-port-connection.html

                      Comment


                      • #12
                        If you are running with firewalls, the problem with active mode is the server initiates the data connection to some random port that the client chooses. Not easy to set up firewalls for that. With passive mode, it's easier.

                        http://lmgtfy.com/?q=ftp+ports+firewall#

                        See

                        http://slacksite.com/other/ftp.html

                        Comment

                        Working...
                        X