Spring异常:匹配的通配符是严格的,但是找不到元素' int-jpa:inbound-channel-adapter'

时间:2018-02-27 00:52:02

标签: spring spring-boot spring-integration

我有以下spring-config xml文件,它正在生成我帖子标题中显示的异常:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-jpa="http://www.springframework.org/schema/integration/jpa"
xmlns:int-sftp="http://www.springframework.org/schema/integration/sftp"
xmlns:file="http://www.springframework.org/schema/integration/file"
xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/util
    http://www.springframework.org/schema/util/spring-util.xsd
    http://www.springframework.org/schema/task
    http://www.springframework.org/schema/task/spring-task.xsd
    http://www.springframework.org/schema/integration
    http://www.springframework.org/schema/integration/spring-integration.xsd
    http://www.springframework.org/schema/integration/jpa
    http://www.springframework.org/schema/integration/jpa/spring-integration-jpa.xsd
    http://www.springframework.org/schema/integration/sftp
    http://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/integration/file
    http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
    http://www.springframework.org/schema/integration/xml
    http://www.springframework.org/schema/integration/xml/spring-
integration-xml.xsd"> 

<int-jpa:inbound-channel-adapter
    id="resultsProcessor"
    channel="responseChannel"
    auto-startup="true"
    named-query="OpenRecords"
    expect-single-result="true"
    delete-after-poll="false"
    entity-class="foo.Request">
        <int:poller 
        id="responsePoller" 
        fixed-rate="5000" 
        max-messages-per-poll="10">
        </int:poller>
</int-jpa:inbound-channel-adapter>

</beans>

我在上面提供的代码中删除了其他元素,并重命名了一些字段以简化示例。这就是为什么您在顶部看到一些不适用于所示示例的架构和命名空间信息的原因。

错误实际发生在 entity-class =&#34; foo.Request&#34;&gt; 对应的行,但我不知道有什么内在的该行错了,但这就是终止&#34;&gt;&#34;是。换句话说,如果我删除了该行并将&#34;&gt;&#34;在删除后轮询=&#34; false&#34; 之后,错误就会出现。

我是否可能缺少命名空间和/或架构位置定义?或者,它可能是缺少部署依赖吗?感谢任何想法。谢谢。

1 个答案:

答案 0 :(得分:1)

请将org.springframework.integration:spring-integration-jpa添加到您的依赖项中。你只是在类路径中遗漏了一个jar