首页 \ 问答 \ Spring ftp配置错误(Spring ftp configuration is wrong)

Spring ftp配置错误(Spring ftp configuration is wrong)

我必须轮询一个ftp位置。 出于测试目的,我使用IIS管理器在我的机器上创建了一个ftp站点。 它在端口21处侦听并启动。

依赖性适合我的项目

这是spring ftp的xml配置

<bean id="ftpClientFactory"
    class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
    <property name="host" value="localhost"/>
    <property name="port" value="21"/>
    <property name="username" value="ICMAS"/>
    <property name="password" value="kavita12"/>
    <property name="clientMode" value="0"/>
    <property name="fileType" value="2"/>
    <property name="bufferSize" value="100000"/>
</bean>
<int-ftp:inbound-channel-adapter id="ftpInbound"
    channel="ftpChannel"
    session-factory="ftpClientFactory"
    charset="UTF-8"
    auto-create-local-directory="true"
    delete-remote-files="true"
    local-filter="compositeFilter"
    remote-directory="c:\ftproot"
    remote-file-separator="\"
    preserve-timestamp="true"
    local-directory="c:\data"
    >
    <int:poller fixed-rate="1000"/>
</int-ftp:inbound-channel-adapter>

<int:channel id="ftpChannel"/>

filenamegenerator和compositefilter存在于我的代码中,但没有在这里编写代码。

我的问题是本地目录正在轮询而不是远程目录。 我认为文件是从远程目录位置读取到过滤器的,如果成功将转到filenamegenerator并放在本地目录位置。 这段代码有什么问题?

如果我做错了,请纠正我。

在这个问题上需要帮助...请加入你的建议!!


I have to poll an ftp location. For testing purpose I have created an ftp site on my machine using IIS manager. It listens at port 21 and is started.

The dependancies are proper for my project

This is the xml configuration for spring ftp

<bean id="ftpClientFactory"
    class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
    <property name="host" value="localhost"/>
    <property name="port" value="21"/>
    <property name="username" value="ICMAS"/>
    <property name="password" value="kavita12"/>
    <property name="clientMode" value="0"/>
    <property name="fileType" value="2"/>
    <property name="bufferSize" value="100000"/>
</bean>
<int-ftp:inbound-channel-adapter id="ftpInbound"
    channel="ftpChannel"
    session-factory="ftpClientFactory"
    charset="UTF-8"
    auto-create-local-directory="true"
    delete-remote-files="true"
    local-filter="compositeFilter"
    remote-directory="c:\ftproot"
    remote-file-separator="\"
    preserve-timestamp="true"
    local-directory="c:\data"
    >
    <int:poller fixed-rate="1000"/>
</int-ftp:inbound-channel-adapter>

<int:channel id="ftpChannel"/>

The filenamegenerator and the compositefilter are present in my code but havent pated their code here.

My problem is that the local-directory is getting polled instead of the remote-directory. I thought that the files are read from the remote-directory location the go to the filter and if successful will go to the filenamegenerator and be put in the local-directory location. What is wrong with this code???

Please correct me if I am doing something wrong.

Need help on this issue... Please put in your suggessions!!


原文:https://stackoverflow.com/questions/26572538
更新时间:2019-07-08 12:55

最满意答案

已经解决了这个问题。

首先,我需要过滤器属性而不是局部过滤器,因为它们之间存在差异。

其次,更重要的是我将romote-directory位置作为绝对路径。 这需要与创建ftp站点时提到的ftp目录相关。

谢谢。 希望这对某人有用!!


Have resolved this issue.

firstly I needed the filter attribute rather than the local-filter as there is a difference in them.

Secondly and more importantly I have given the romote-directory location as the absolute path. That needs to be relative to the ftp directory mentioned while creating the ftp site.

Thanks. Hope this is useful to someone!!

2014-10-30

相关问答

更多

Spring集成-FTP与Openshift不兼容(Spring Integration-FTP is not working with Openshift)

根据Linux团队的说法,Openshift不支持FTP客户端,并且不可能在Openshift中使用弹簧集成运行FTP As per Linux team, Openshift is not supporting FTP Client and it is not possible to run FTP using spring integration in Openshift

春季安全中的配置问题(Configuration issue in spring security)

你在pom.xml和security-contex.xml中有错误的Spring Security版本:前者指向3.0.2,后者指向3.0.3,因此: 将pom.xml更新到3.0.3(或更高版本) 或者在您的安全配置中使用http://www.springframework.org/schema/security/spring-security-3.0.xsd 。 顺便说一下,有没有理由不使用当前的Spring Security版本 (3.0.8 / 3.1.3)? You have wrong ...

如何在spring中将xml bean配置文件导入@configuration类?(How can I import a xml bean configuration file to a @configuration class in spring?)

正如@Sotirios在评论中所说,你应该删除/resources前缀。 但是你也使用了错误的注释: @PropertySource用于导入属性文件。 您应该使用@ImportResource注释。 @Configuration @ImportResource("classpath:applicationContext.xml") public class AppConfig { // define more beans, wire beans defined in the xml, e ...

使用Java配置配置eclipselink + Spring MVC + MySql(无XML配置)(Configuration of eclipselink + Spring MVC + MySql using Java Configuration (No XML configuration))

以下配置将使Spring能够使用两个应用程序上下文(根上下文和Web应用程序上下文),并将配置您需要的大部分内容。 @Configuration @EnableTransactionManagement @EnableMBeanExport @EnableJpaRepositories("your.jpa.repositories.package") @ComponentScan(basePackages = "gr.xe.payments", excludeFilters = {@Compone ...

Spring Boot Elasticsearch配置(Spring Boot Elasticsearch Configuration)

删除你的配置类和属性。 添加以下依赖项 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-elasticsearch</artifactId> </dependency> 只需将spring.data.elasticsearch属性添加到application-prod.properties和application-dev.properties ...

Crud存储库的Spring bean配置(Spring bean configuration for Crud Repositories)

问题不在您的bean配置中,但您必须在Customer类中声明@Id,如下所示 @Document( indexName = "Customer", type = "cust" ) public class Customer{ @Id private String id; private String name; //setters and getters } 您需要拥有Id才能为实体编制索引,SD elasticsearch不支持在没有 ...

Spring Batch partitioning -Queue配置(Spring Batch partitioning -Queue configuration)

通常他们都是一样的; 大师协调工作但也参与。 测试用例具有示例配置。 Typically they are all the same; the master coordinates the work but also participates. The test case has sample configuration.

Camel 2.14.0 / CXF 3.0.1 Jetty配置:协议不匹配错误(Camel 2.14.0/CXF 3.0.1 Jetty configuration: Protocol mismatch error)

由于协议不匹配错误是由于CXF跳过了jetty配置bean的bean初始化而引起的。 但是,事实证明,通过内部Spring版本更改CXF扩展Spring配置类会导致某些问题。 在删除extends SoapSSLConfig中的extends SoapSSLConfig并使用@Import(SoapSSLConfig.class)注入此配置类时,bean初始化以及Jetty服务器配置将像以前一样执行。 代码曾经是: @Configuration @ImportResource({ "classpa ...

相关文章

更多

最新问答

更多
  • Android宽度:100%修复(网站接管问题)(Android width:100% fix (website takeover issue))
  • C ++函数/方法设计的良好实践(Good practice in C++ function/method design)
  • 计算其他表中不存在的所有记录 - SQL查询(Count all records that does not exist to other table - SQL Query)
  • 为什么我要用JPA共享ID?(Why do I get shared Ids with JPA?)
  • asp.net - 如何显示来自html格式的数据行的字段(asp.net - how to display a field from data row that is in html format)
  • 我们如何使用ActiveRecord从连接表中删除行?(How can we delete rows from a join table by using ActiveRecord?)
  • ng-class搞乱了类的顺序(ng-class messing with the order of classes)
  • oracle 12g无效数字错误(oracle 12g invalid number error)
  • 更改ng-src值onclick(Change ng-src value onclick)
  • 如何在android中自动添加自定义依赖项以创建新项目?(How to add custom dependencies automatically in android for ever a new project is created?)
  • datetime函数在PHP中(datetime function in php)
  • 在javascript中获取会话数组的值(in javascript get the value of a session array)
  • 如何在UTF8中编译LaTeX?(How can I compile LaTeX in UTF8? [closed])
  • Rspec:“array.should == another_array”,但不用担心订单(Rspec: “array.should == another_array” but without concern for order)
  • Logcat错误:无法在android片段中加载视图(Logcat error: unable to load view in android fragments)
  • JavaFX的。(JavaFX. Adding items to the list in different threads is not working)
  • 从GDATA日历资源迁移到Google Calendar Resource api(Migrate from GDATA calendar resource to Google Calendar Resource api)
  • SSRS 2008 - 以零情景处理分割(SSRS 2008 - Dealing with division by zero scenarios)
  • 我如何以编程方式添加一个listView列标题的点击事件(How can I add a listView column header a click event programmatically)
  • Wxpython:无法检索有关列表控件项XXX的信息(Wxpython: Couldn't retrieve information about list control item XXX)
  • 使用Tortoise SVN在SVN存储库中移动目录(Move Directory across SVN repository using Tortoise SVN)
  • 天蓝色服务结构集群中的web api无状态服务是否在一段时间不活动后进入休眠状态?(Do web api stateless services in azure service fabric cluster go to sleep after a period of inactivity?)
  • 我可以设置intelliJ来突出显示PHP编码风格吗?(Can I set intelliJ to highlight php coding style?)
  • 用javafx创建一个Truetype字体文件(Creating a Truetype Font file with javafx)
  • Spring ftp配置错误(Spring ftp configuration is wrong)
  • 使用gsub去除多个字符(Using gsub to strip multiple characters)
  • 续订推送证书并保持当前的App Store App正常工作(Renew Push certificate and keep current App Store App working)
  • js:ES5和ES6之间关于'this'关键字用法的一个令人困惑的观点(js: one confusing point about 'this' keyword usage between ES5 and ES6)
  • window.onload vs $(document).ready()(window.onload vs $(document).ready())
  • 在Swift中,如何声明一个符合一个或多个协议的特定类型的变量?(In Swift, how can I declare a variable of a specific type that conforms to one or more protocols?)