We went through couple of solutions provided on tranferring files using FTPS. They are working fine with lower versions of Java like Java 11 etc. But are facing the same "SSL peer shut down incorrectly" issue in Java 17. Please let us know if there is any solution for Java 17.
Reffered Links :
How to connect to FTPS server with data connection using same TLS session? (Solution working fine in Java 11)
Stack trace:
Caused by: java.io.EOFException: SSL peer shut down incorrectly at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:483) at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472) at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160) at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111) at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1505) ... 9 more
Already tried below links:
Solution:
Adding System.setProperty("jdk.tls.client.enableSessionTicketExtension", "false") fixed the issue!
I encountered the same issue attempting connect to a FileZilla server with apache FTPSClient on Java 17.
Finally, the connection worked with this configuration :
Downgrading TLS version (TLSv1.2 instead of TLSv1.3)
According this link : https://gitlab.com/gnutls/gnutls/-/issues/1451
JDK has a compatibility issues with TLSv1.3 caused by a non-standard use of 'user_canceled' message.
Using a custom implementation of FTPSClient that permits SSL Session reuse
(From Filezilla-forum)
According this link : How to establish a FTPS data connection to a FileZilla Server 1.2.0
Here is the copied/pasted implementation that meets the prerequisites
You must open this 2 modules to allow reflection on SSLSession :
--add-opens=java.base/sun.security.ssl=ALL-UNNAMED --add-opens=java.base/sun.security.util=ALL-UNNAMED