面对Spring Ftps集成的问题

时间:2014-08-27 10:18:12

标签: spring spring-mvc spring-integration

当我使用此ftps设置时

<property name="cipherSuites" value="a,b.c"/>

我正在异常

org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.IllegalStateException: failed to create FTPClient]
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)
* Nested Exception (Underlying Cause) ---------------
java.lang.IllegalStateException: failed to create FTPClient
    at com.sapienter.jbilling.server.mediation.sourcereader.AbstractRemoteFileRetriever.copyToLocalFileSystem(AbstractRemoteFileRetriever.java:131)
    at com.sapienter.jbilling.server.mediation.sourcereader.FtpsFileRetriever.copyToLocalFileSystemFrom(FtpsFileRetriever.java:96)
    at com.sapienter.jbilling.server.process.task.FtpRemoteCopyTask.execute(FtpRemoteCopyTask.java:91)
    at com.sapienter.jbilling.server.process.task.FileExchangeTriggerTask.doExecute(FileExchangeTriggerTask.java:43)
    at com.sapienter.jbilling.server.process.task.ScheduledTask.execute(ScheduledTask.java:107)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)
Caused by: java.lang.IllegalArgumentException: Unsupported ciphersuite a
    at com.sun.net.ssl.internal.ssl.CipherSuite.valueOf(CipherSuite.java:184)
    at com.sun.net.ssl.internal.ssl.CipherSuiteList.<init>(CipherSuiteList.java:69)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.setEnabledCipherSuites(SSLSocketImpl.java:2162)
    at org.apache.commons.net.ftp.FTPSClient.sslNegotiation(FTPSClient.java:258)
    at org.apache.commons.net.ftp.FTPSClient._connectAction_(FTPSClient.java:205)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:169)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:189)

这是我的配置设置

<bean id="ftpsDefaultSessionFactory" class="org.springframework.integration.ftp.session.DefaultFtpsSessionFactory"           scope="prototype">
        <property name="host" value="127.0.0.1"/>
        <property name="port" value="22"/>
        <property name="username" value="ftpuser"/>
        <property name="password" value="neeraj"/>
        <property name="clientMode" value="2"/>
        <property name="fileType" value="2"/>
        <property name="useClientMode" value="true"/>
        <property name="cipherSuites" value="a,b.c"/>
        <property name="keyManager" ref="keyManager"/>
        <property name="trustManager" ref="trustManager"/>
        <property name="wantsClientAuth" value="false"/>
        <property name="needClientAuth" value="true"/>
        <property name="sessionCreation" value="true"/>
        <!--<property name="authValue" value="neeraj"/>-->
        <property name="protocol" value="SSL"/>
        <property name="prot" value="P"/>
        <property name="implicit" value="false"/>
         <property name="protocols" value="SSL, TLS"/>
    </bean>

我是从http://docs.spring.io/spring-integration/reference/html/ftp.html引用这些设置的。

有人有任何想法,我将如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

<property name="cipherSuites" value="a,b.c"/>

它们不是真正的密码套件,doc只显示可用属性而不是它们的实际值。

除非您有特殊要求,否则您通常不需要提供该物业。

答案 1 :(得分:1)

请参阅org.apache.commons.net.ftp.FTPSClient API和文档,您应该能够正确配置DefaultFtpsSessionFactory。希望在创建FTPSClient实例时使用默认值,您可能不需要在DefaultFtpsSessionFactory中设置所有其他属性。