属性'固定利率'不允许出现在元素' int:poller'

时间:2015-02-20 09:31:52

标签: java xml spring

我无法添加属性"固定费率"在轮询器标签下,给出"属性'固定率'不允许出现在元素' int:poller'。"。 请参考下面的xml文件。

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:int="http://www.springframework.org/schema/integration"
  xmlns:beans="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:int-sftp="http://www.springframework.org/schema/integration/sftp"
             xsi:schemaLocation="http://www.springframework.org/schema/integration
             http://www.springframework.org/schema/integration/spring-integration.xsd
             http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans.xsd
             http://www.springframework.org/schema/integration/sftp
             http://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd">

    <int:channel id="fileTransferChannel"/>

    <int:inbound-channel-adapter id="fileTransferChannelAdapter" auto-startup="true" ref="fileTransferCollector" method="poll" channel="fileTransferChannel">
        <int:poller fixed-rate="500"/>
    </int:inbound-channel-adapter>

</beans:beans>

请帮助解决此问题


将代码更改为

&#13;
&#13;
<int:poller>
        	<int:interval-trigger interval="1000" fixed-rate="500"/>
        </int:poller>
&#13;
&#13;
&#13;

我正处于异常

之下

违规资源:类路径资源[appcont.xml];嵌套异常是org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:来自类路径资源[filetransfer.xml]的XML文档中的第17行无效;嵌套异常是org.xml.sax.SAXParseException; lineNumber:17; columnNumber:66; cvc-complex-type.2.4.a:从元素&#39; int:interval-trigger&#39;开始发现无效内容。其中一个{&#34; http://www.springframework.org/schema/integration&#34;:transactional,&#34; http://www.springframework.org/schema/integration&#34;:advice-chain}&#39;是期待。     在org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)     在org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)     在org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)     在org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:271)     在org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:196)     在org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:181)     在org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)     在org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)     在org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)     在org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)     在org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)     在org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)     在org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)     在org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)     在org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)     at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)     at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)     在org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:530)     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:444)     在org.springframework.context.support.ClassPathXmlApplicationContext。(ClassPathXmlApplicationContext.java:139)

5 个答案:

答案 0 :(得分:0)

那是因为架构不允许该元素的fixed-rate属性。我的猜测是你想要这个:

<int:inbound-channel-adapter .... >
    <int:poller >
        <int:interval-trigger fixed-rate=".." />
    </int:poller >
</int:inbound-channel-adapter>

答案 1 :(得分:0)

我遇到了同样的问题,我可以这样解决:

<int:inbound-channel-adapter id="fileTransferChannelAdapter" auto-startup="true" ref="fileTransferCollector" method="poll" channel="fileTransferChannel">
    <int:poller fixed-rate="500">
    </int:poller>
</int:inbound-channel-adapter>

答案 2 :(得分:0)

我知道我迟到了,但我正在为像我这样偶然发现的人添加这个。有时可能是由于简单的错误,如不包括弹簧依赖性。我将应用程序移动到spring boot并忘记包含以下两个依赖项,并且我收到此错误。如果直接在pom中使用而没有依赖管理弹簧集成的BOM,那么你应该在下面的依赖项中添加版本。

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-integration</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-file</artifactId>
        </dependency>

答案 3 :(得分:0)

将标签替换为以下内容:

<int:poller>
    <int:interval-trigger interval="1000" fixed-rate="500"/>
</int:poller>

答案 4 :(得分:0)

仅通过将此依赖项添加到pom.xml中,它便对我有用

<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-jdbc</artifactId>
</dependency>