0
我試圖用Spring上傳文件,但我面臨着我不明白的問題。使用Spring框架的FTP文件傳輸
這是我的一個適配器和會話工廠的定義:
<bean id="ftpClientFactory"
class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
<property name="host" value="127.0.0.1"/>
<property name="port" value="21"/>
<property name="username" value="test"/>
<property name="password" value="test"/>
<property name="clientMode" value="0"/>
</bean>
<si:channel id="ftpChannel"/>
<int-ftp:outbound-channel-adapter id="ftpOutbound"
channel="ftpChannel"
remote-directory="/Users/testUser"
session-factory="ftpClientFactory"/>
和這裏的錯誤,我得到:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ftpOutbound': Cannot resolve reference to bean 'org.springframework.integration.file.remote.handler.FileTransferringMessageHandler#0' while setting bean property 'handler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.file.remote.handler.FileTransferringMessageHandler#0': Cannot create inner bean '(inner bean)' of type [org.springframework.integration.file.remote.session.SessionFactoryFactoryBean] while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)': Unsatisfied dependency expressed through constructor argument with index 1 of type [boolean]: Could not convert constructor argument value of type [java.lang.String] to required type [boolean]: Failed to convert value of type 'java.lang.String' to required type 'boolean'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value []
任何想法,我究竟做錯了什麼?謝謝你的建議。
我已經添加了緩存會話並切換到最新版本的spring集成,現在我收到了這個錯誤: org.springframework.beans.factory.xml。 XmlBeanDefinitionStoreException:來自類路徑資源[citrus-context.xml]的XML文檔中的第553行無效;嵌套異常是org.xml.sax.SAXParseException; systemId:http://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd; lineNumber:553; columnNumber:71; src-resolve:無法將名稱'integration:smartLifeCycleAttributeGroup'解析爲(n)'屬性組'組件。 – mlethys
您應該升級所有Spring集成jar併爲Spring Nature配置IDE,以便從CLASSPATH而不是Internet解析XSD。自從2.2版本以來''cache-sessions'已被刪除。使用最新版本,您應該在目標'sesssionFactory'周圍配置'CachingSessionFactory'來實現緩存功能。 –