I've a Talend 7.3 job that create locally some .csv files and then send them to the FTPS server on 990 port. In the IDE all work, but when I export the job (right click -> build job) the .bat file give me this exception:
java.lang.reflect.InaccessibleObjectException: Unable to make field private final sun.security.util.Cache sun.security.ssl.SSLSessionContextImpl.sessionHostPortCache accessible: module java.base does not "opens sun.security.ssl" to unnamed module
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:177)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:171)
at org.talend.ftp.SSLSessionReuseFTPSClient._prepareDataSocket_(SSLSessionReuseFTPSClient.java:29)
at org.apache.commons.net.ftp.FTPSClient._openDataConnection_(FTPSClient.java:628)
at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:785)
at org.apache.commons.net.ftp.FTPClient.listNames(FTPClient.java:2905)
at org.apache.commons.net.ftp.FTPClient.listNames(FTPClient.java:2956)
at --------------.--------------_0_1.--------------.tFTPPut_1Process(--------------.java:14760)
at --------------.--------------_0_1.--------------.runJobInTOS(--------------.java:15224)
at --------------.--------------_0_1.--------------.main(--------------.java:14993)
Exception in component tFTPPut_1 (--------------)
javax.net.ssl.SSLProtocolException: Received close_notify during handshake
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:129)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:356)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:312)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:303)
at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:250)
at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:202)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:171)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1501)
at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1466)
at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1048)
at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:297)
at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188)
at java.base/java.io.InputStreamReader.read(InputStreamReader.java:178)
at java.base/java.io.BufferedReader.fill(BufferedReader.java:161)
at java.base/java.io.BufferedReader.readLine(BufferedReader.java:329)
at java.base/java.io.BufferedReader.readLine(BufferedReader.java:396)
at org.apache.commons.net.ftp.FTPClient.listNames(FTPClient.java:2916)
at org.apache.commons.net.ftp.FTPClient.listNames(FTPClient.java:2956)
at --------------.--------------_0_1.--------------.tFTPPut_1Process(--------------.java:14760)
at --------------.--------------_0_1.--------------.runJobInTOS(--------------.java:15224)
at --------------.--------------_0_1.--------------.main(--------------.java:14993)
I think the problem is something in Windows because I can't open a connection from terminal with ftp open <host>
.
The library/tool, you are using, seems to use this hack to allow connection to FTPS servers that require TLS session reuse:
How to connect to FTPS server with data connection using same TLS session?
The hack requires reflection access. What does not seem to be allowed in your runtime. I'm not Java expert, but this question seems to cover the problem:
How to solve InaccessibleObjectException ("Unable to make {member} accessible: module {A} does not 'opens {package}' to {B}") on Java 9?
(Maybe someone with more Java experience can build upon this information)