在 Windows 上尝试在 FTPS 中连接时 Talend 作业失败 "module java.base does not " 打开 sun.security.ssl“未命名模块”

Talend jobs when trying to connect in FTPS on Windows fails "module java.base does not "opens sun.security.ssl" to unnamed module"

我有一个 Talend 7.3 作业,它在本地创建一些 .csv 文件,然后将它们发送到 990 端口上的 FTPS 服务器。在 IDE 中一切正常,但是当我导出作业(右键单击 -> 构建作业)时,.bat 文件给我这个异常:

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)

我认为问题出在 Windows 中,因为我无法使用 ftp open <host>.

从终端打开连接

您正在使用的 library/tool 似乎使用此 hack 来允许连接到需要 TLS 会话重用的 FTPS 服务器:

破解需要反射访问。您的运行时似乎不允许的内容。我不是 Java 专家,但这个问题似乎涵盖了问题:

(也许有更多 Java 经验的人可以利用这些信息)