gpt4 book ai didi

java.net.SocketException : Malformed reply from SOCKS server, 使用 apache FTPClient

转载 作者:行者123 更新时间:2023-12-04 10:48:07 25 4
gpt4 key购买 nike

我正在尝试在 java web start 应用程序中使用 Apache FTPCleint 连接到 FTP 服务器。下面是我正在使用的代码。

ftpInstance = new FTPClient();

ftpInstance.setRemoteVerificationEnabled(false);

ftpInstance.connect(<HostName>);
int rpyCode = ftpInstance.getReplyCode();

if(!FTPReply.isPositiveCompletion(rpyCode)){
throw new Exception("Connection Rejected with reply code " + rpyCode + ". - " + <Hostname>);
}

问题出在 ftpInstance.connect(<HostName>) 行.抛出异常请查看堆栈跟踪

java.lang.RuntimeException: java.net.SocketException: Malformed reply from SOCKS server
at com.newgen.backend.Operation.call(Operation.java:91)
at filetransfermanager.FileTransferManagerView$1.windowOpened(FileTransferManagerView.java:48)
at java.awt.AWTEventMulticaster.windowOpened(Unknown Source)
at java.awt.Window.processWindowEvent(Unknown Source)
at javax.swing.JFrame.processWindowEvent(Unknown Source)
at java.awt.Window.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Caused by: java.net.SocketException: Malformed reply from SOCKS server
at java.net.SocksSocketImpl.readSocksReply(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:171)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:192)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:285)
at com.newgen.ftp.FTPInstance.getInstance(FTPInstance.java:38)
at com.newgen.backend.Transport.<init>(Transport.java:58)
at com.newgen.backend.Operation.call(Operation.java:81)
... 27 more

以上代码在正常项目中运行良好,但在 java web start 中却不行。

感谢任何帮助。谢谢。

最佳答案

您配置了指向非 SOCKS 代理的 SOCKS 代理设置。

关于java.net.SocketException : Malformed reply from SOCKS server, 使用 apache FTPClient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14682521/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com