Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to connect to FTP Server using Apache FTPCleint in java web start aplication. Below is the code i am using.

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>);
}

Problem is at line ftpInstance.connect(<HostName>). An exception is been thrown Please look at the stack trace

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

Above code is working fine in normal project but not in java web start.

Any help is appreciated. Thanks.

like image 765
Kapil Soni Avatar asked Feb 24 '26 18:02

Kapil Soni


1 Answers

You have configured SOCKS proxy settings that point to something that isn't a SOCKS proxy.

like image 157
user207421 Avatar answered Feb 26 '26 07:02

user207421



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!