Spring 集成 DefaultFtpsSessionFactory
Spring Integration DefaultFtpsSessionFactory
在我们将 spring 引导升级到 2.4.2 版本之前,此配置对我来说非常有效。
DefaultFtpsSessionFactory sessionFactory = new DefaultFtpsSessionFactory();
sessionFactory.setHost("host");
sessionFactory.setUsername("username");
sessionFactory.setPassword("password");
sessionFactory.setPort(21);
sessionFactory.setClientMode(FTPClient.PASSIVE_LOCAL_DATA_CONNECTION_MODE);
sessionFactory.setControlEncoding("UTF-8");
目前我面临以下异常:
javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
我在文档中找不到任何内容。
感谢您的回答。
编辑 1#:
@ArtemBilan 这里是堆栈跟踪:
Caused by: javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
at sun.security.ssl.SSLSocketInputRecord.handleUnknownRecord(SSLSocketInputRecord.java:439) ~[?:?]
at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:184) ~[?:?]
at sun.security.ssl.SSLTransport.decode(SSLTransport.java:108) ~[?:?]
at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152) ~[?:?]
at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063) ~[?:?]
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402) ~[?:?]
at org.apache.commons.net.ftp.FTPSClient._openDataConnection_(FTPSClient.java:642) ~[commons-net-3.7.jar:3.7]
at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:790) ~[commons-net-3.7.jar:3.7]
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3456) ~[commons-net-3.7.jar:3.7]
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3386) ~[commons-net-3.7.jar:3.7]
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:3063) ~[commons-net-3.7.jar:3.7]
at org.springframework.integration.ftp.session.FtpSession.list(FtpSession.java:74) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.session.FtpSession.list(FtpSession.java:45) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.session.CachingSessionFactory$CachedSession.list(CachingSessionFactory.java:225) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.listFilesInRemoteDir(AbstractRemoteFileOutboundGateway.java:948) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.ls(AbstractRemoteFileOutboundGateway.java:913) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.lambda$ls[=12=](FtpOutboundGateway.java:209) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.doInWorkingDirectory(FtpOutboundGateway.java:285) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.ls(FtpOutboundGateway.java:209) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.lsRemoteFilesForMget(AbstractRemoteFileOutboundGateway.java:1202) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.mGetWithRecursion(AbstractRemoteFileOutboundGateway.java:1182) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.mGet(AbstractRemoteFileOutboundGateway.java:1127) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.lambda$mGet(FtpOutboundGateway.java:230) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.doInWorkingDirectory(FtpOutboundGateway.java:285) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.mGet(FtpOutboundGateway.java:229) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.lambda$doMget(AbstractRemoteFileOutboundGateway.java:683) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:439) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.doMget(AbstractRemoteFileOutboundGateway.java:682) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.handleRequestMessage(AbstractRemoteFileOutboundGateway.java:573) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:134) ~[spring-integration-core-5.4.3.jar:5.4.3]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:56) ~[spring-integration-core-5.4.3.jar:5.4.3]
... 43 more
编辑#2
[INFO] +- commons-net:commons-net:jar:3.7.2:compile
[INFO] +- org.springframework.integration:spring-integration-ftp:jar:5.4.3:compile
编辑 #3 - 一些异常在堆栈中更高,只是为了完整性
Caused by: org.springframework.messaging.MessagingException: Failed to execute on session; nested exception is javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:448) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.doMget(AbstractRemoteFileOutboundGateway.java:682) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.handleRequestMessage(AbstractRemoteFileOutboundGateway.java:573) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:134) ~[spring-integration-core-5.4.3.jar:5.4.3]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:56) ~[spring-integration-core-5.4.3.jar:5.4.3]
... 43 more
编辑 4# 试验 commons-net:jar:3.7.2
以下设置工作正常
[INFO] +- commons-net:commons-net:jar:3.7.2:compile
[INFO] +- org.springframework.integration:spring-integration-ftp:jar:5.3.2.RELEASE:compile
[INFO] | \- org.springframework.integration:spring-integration-file:jar:5.4.3:compile
[INFO] | \- org.springframework.integration:spring-integration-core:jar:5.4.3:compile
[INFO] | \- org.springframework.retry:spring-retry:jar:1.3.1:compile
请考虑使用 commons-net:commons-net:3.7.2
依赖项。
我们确实将 Spring 版本 5.4
的集成从旧的 3.6
升级到 commons-net
3.7
。
查看此问题了解更多详情:https://github.com/spring-projects/spring-integration/issues/3463。
我们计划下周发布 5.4.4
:https://calendar.spring.io/
将 spring-integration-ftp 降级到 5.3 版本后。2.RELEASE 它可以工作。
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-ftp</artifactId>
<version>5.3.2.RELEASE</version>
</dependency>
在我们将 spring 引导升级到 2.4.2 版本之前,此配置对我来说非常有效。
DefaultFtpsSessionFactory sessionFactory = new DefaultFtpsSessionFactory();
sessionFactory.setHost("host");
sessionFactory.setUsername("username");
sessionFactory.setPassword("password");
sessionFactory.setPort(21);
sessionFactory.setClientMode(FTPClient.PASSIVE_LOCAL_DATA_CONNECTION_MODE);
sessionFactory.setControlEncoding("UTF-8");
目前我面临以下异常:
javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
我在文档中找不到任何内容。
感谢您的回答。
编辑 1#:
@ArtemBilan 这里是堆栈跟踪:
Caused by: javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
at sun.security.ssl.SSLSocketInputRecord.handleUnknownRecord(SSLSocketInputRecord.java:439) ~[?:?]
at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:184) ~[?:?]
at sun.security.ssl.SSLTransport.decode(SSLTransport.java:108) ~[?:?]
at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152) ~[?:?]
at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063) ~[?:?]
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402) ~[?:?]
at org.apache.commons.net.ftp.FTPSClient._openDataConnection_(FTPSClient.java:642) ~[commons-net-3.7.jar:3.7]
at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:790) ~[commons-net-3.7.jar:3.7]
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3456) ~[commons-net-3.7.jar:3.7]
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3386) ~[commons-net-3.7.jar:3.7]
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:3063) ~[commons-net-3.7.jar:3.7]
at org.springframework.integration.ftp.session.FtpSession.list(FtpSession.java:74) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.session.FtpSession.list(FtpSession.java:45) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.session.CachingSessionFactory$CachedSession.list(CachingSessionFactory.java:225) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.listFilesInRemoteDir(AbstractRemoteFileOutboundGateway.java:948) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.ls(AbstractRemoteFileOutboundGateway.java:913) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.lambda$ls[=12=](FtpOutboundGateway.java:209) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.doInWorkingDirectory(FtpOutboundGateway.java:285) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.ls(FtpOutboundGateway.java:209) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.lsRemoteFilesForMget(AbstractRemoteFileOutboundGateway.java:1202) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.mGetWithRecursion(AbstractRemoteFileOutboundGateway.java:1182) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.mGet(AbstractRemoteFileOutboundGateway.java:1127) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.lambda$mGet(FtpOutboundGateway.java:230) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.doInWorkingDirectory(FtpOutboundGateway.java:285) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.ftp.gateway.FtpOutboundGateway.mGet(FtpOutboundGateway.java:229) ~[spring-integration-ftp-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.lambda$doMget(AbstractRemoteFileOutboundGateway.java:683) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:439) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.doMget(AbstractRemoteFileOutboundGateway.java:682) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.handleRequestMessage(AbstractRemoteFileOutboundGateway.java:573) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:134) ~[spring-integration-core-5.4.3.jar:5.4.3]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:56) ~[spring-integration-core-5.4.3.jar:5.4.3]
... 43 more
编辑#2
[INFO] +- commons-net:commons-net:jar:3.7.2:compile
[INFO] +- org.springframework.integration:spring-integration-ftp:jar:5.4.3:compile
编辑 #3 - 一些异常在堆栈中更高,只是为了完整性
Caused by: org.springframework.messaging.MessagingException: Failed to execute on session; nested exception is javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:448) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.doMget(AbstractRemoteFileOutboundGateway.java:682) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.handleRequestMessage(AbstractRemoteFileOutboundGateway.java:573) ~[spring-integration-file-5.4.3.jar:5.4.3]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:134) ~[spring-integration-core-5.4.3.jar:5.4.3]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:56) ~[spring-integration-core-5.4.3.jar:5.4.3]
... 43 more
编辑 4# 试验 commons-net:jar:3.7.2
以下设置工作正常
[INFO] +- commons-net:commons-net:jar:3.7.2:compile
[INFO] +- org.springframework.integration:spring-integration-ftp:jar:5.3.2.RELEASE:compile
[INFO] | \- org.springframework.integration:spring-integration-file:jar:5.4.3:compile
[INFO] | \- org.springframework.integration:spring-integration-core:jar:5.4.3:compile
[INFO] | \- org.springframework.retry:spring-retry:jar:1.3.1:compile
请考虑使用 commons-net:commons-net:3.7.2
依赖项。
我们确实将 Spring 版本 5.4
的集成从旧的 3.6
升级到 commons-net
3.7
。
查看此问题了解更多详情:https://github.com/spring-projects/spring-integration/issues/3463。
我们计划下周发布 5.4.4
:https://calendar.spring.io/
将 spring-integration-ftp 降级到 5.3 版本后。2.RELEASE 它可以工作。
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-ftp</artifactId>
<version>5.3.2.RELEASE</version>
</dependency>