日期:2014-05-16  浏览次数:20896 次

org.apache.commons.net.ftp.FTPClient 在netbeans下的异常分析
无论在netbeans GUI下怎么连接都是报这个异常,搞了4个小时,受伤了....
java.net.SocketException: Malformed reply from SOCKS server
        at java.net.SocksSocketImpl.readSocksReply(SocksSocketImpl.java:90)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:429)
        at java.net.Socket.connect(Socket.java:529)
        at java.net.Socket.connect(Socket.java:478)
        at java.net.Socket.<init>(Socket.java:375)
        at java.net.Socket.<init>(Socket.java:189)
        at org.apache.commons.net.DefaultSocketFactory.createSocket(DefaultSocketFactory.java:53)
        at org.apache.commons.net.SocketClient.connect(SocketClient.java:162)
        at autodeploy.ftp.FtpUtil.login(FtpUtil.java:52)
        at autodeploy.AutoDeployView$AutoDeployTask.doInBackground(AutoDeployView.java:356)
        at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

最后终于找打“伟*哥”的一篇文章,才闹明白原来NetBeans Swing Application Framework 的 org.jdesktop.application.Application.create() 调用了
System.setProperty("java.net.useSystemProxies", "true"); 太感谢“伟*哥”了,在适当的位置 写入
System.setProperty("java.net.useSystemProxies", "false"); 

程序调试成功!