zoukankan      html  css  js  c++  java
  • ftp4j揭示java.net.SocketException: Connection reset的解决

    ftp4j提示java.net.SocketException: Connection reset的解决
    系统的自动更新FTP服务器,其他计算机连接都没有问题,包括xp、server2008、win7、win8,简体和繁体。

    今天发现一台简体win7无法自动更新,提示错误如下:
    java.net.SocketException: Connection reset
            at java.net.SocketInputStream.read(Unknown Source)
            at java.net.SocketInputStream.read(Unknown Source)
            at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
            at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
            at sun.nio.cs.StreamDecoder.read(Unknown Source)
            at sun.nio.cs.StreamDecoder.read0(Unknown Source)
            at sun.nio.cs.StreamDecoder.read(Unknown Source)
            at java.io.InputStreamReader.read(Unknown Source)
            at it.sauronsoftware.ftp4j.NVTASCIIReader.readLine(NVTASCIIReader.java:1
    05)
            at it.sauronsoftware.ftp4j.FTPCommunicationChannel.read(FTPCommunication
    Channel.java:142)
            at it.sauronsoftware.ftp4j.FTPCommunicationChannel.readFTPReply(FTPCommu
    nicationChannel.java:185)
            at it.sauronsoftware.ftp4j.FTPClient.openPassiveDataTransferChannel(FTPC
    lient.java:3179)
            at it.sauronsoftware.ftp4j.FTPClient.openDataTransferChannel(FTPClient.j
    ava:3113)
            at it.sauronsoftware.ftp4j.FTPClient.list(FTPClient.java:2019)
            at it.sauronsoftware.ftp4j.FTPClient.list(FTPClient.java:2193)
            at cn.stjauns.logan.updater.Updater.getRemotefiles(Updater.java:199)
            at cn.stjauns.logan.updater.Updater.doUpdate(Updater.java:58)
            at cn.stjauns.logan.updater.Starter.main(Starter.java:18)

    关闭win7自带防火墙,一切正常。

    上百度查询,无果。
    上google查询,答案见:http://stackoverflow.com/questions/10166337/ftp-error-while-downloading-uploading-with-ftp4j-library-in-java-application。

    引用

    Apparently there is a bug on the Windows 7 firewall related to using FTP on IPv6 that would explain your problem. See bug report here.

    Any one of the following workarounds should suffice to fix it:

    Run the following as an administrator in a Windows console:

    netsh advfirewall set global StatefulFtp disable

    Run the JVM with the option: -Djava.net.preferIPv4Stack=true



    打开win7防火墙,以管理员身份运行cmd,运行如下命令:
    netsh advfirewall set global StatefulFtp disable
    问题解决。

  • 相关阅读:
    通过接口实现适用于SqlServer和MySql的SqlHelper
    javascript面向对象(二)
    闭包
    javascript面向对象(一)
    引用类型——function
    引用类型——数组
    引用类型
    javascript变量的作用域
    正则表达式语法
    FCKeditor插件 中文解释
  • 原文地址:https://www.cnblogs.com/laobiao/p/5965661.html
Copyright © 2011-2022 走看看