Java Spring集成JDBC Insert语句

Java Spring集成JDBC Insert语句,java,spring,spring-integration,Java,Spring,Spring Integration,我不熟悉Spring集成。我正在尝试为我的数据库编写POJO。我得到了这个错误,我不太明白。我的语法是否错误,或者我是否以错误的方式使用通道/适配器/网关 找不到元素intjdbc:outbound channel adapter的声明 这是我的密码: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="

我不熟悉Spring集成。我正在尝试为我的数据库编写POJO。我得到了这个错误,我不太明白。我的语法是否错误,或者我是否以错误的方式使用通道/适配器/网关

找不到元素
intjdbc:outbound channel adapter
的声明

这是我的密码:

 <?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:integration="http://www.springframework.org/schema/integration"
    xmlns:file="http://www.springframework.org/schema/integration/file"
    xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
    xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
    xmlns:util="http://www.springframework.org/schema/util" xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
    xsi:schemaLocation="http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.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/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
        http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd
        http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">


<int-jdbc:outbound-gateway id="transmissionGateway"
    query="insert into MSRB_RTRS (Sec_ID, SourceLoad_ID, TradeDate) values (:Sec_ID, 
    :SourceLoad_ID, :TradeDate)"
    data-source="rmsa">

</int-jdbc:outbound-gateway>

以下是我的依赖项:

<dependencies>
    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-jdbc</artifactId>
        <version>4.3.5.RELEASE</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <version>6.0.8112.100</version>
    </dependency>
    <dependency>
        <groupId>com.companyname</groupId>
        <artifactId>spring-boot-common</artifactId>
        <version>1.0.0.COMMON-SBCOMMON-14</version>
    </dependency>
    <dependency>
        <groupId>c3p0</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.13</version>
    </dependency>


    <!-- End -->
    <dependency>
        <groupId>com.companyname</groupId>
        <artifactId>companyname-spring-core-spring-4</artifactId>
        <version>1.1-M20160505-01</version>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.4.5</version>
    </dependency>
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>

org.springframework.integration
spring集成jdbc
4.3.5.1发布
聚甲醛
com.microsoft.sqlserver
mssql jdbc
6.0.8112.100
com.companyname
普通弹簧靴
1.0.0.COMMON-SBCOMMON-14
c3p0
c3p0
0.9.1.2
org.codehaus.jackson
杰克逊地图绘制者
1.9.13
com.companyname
公司名称-spring-core-spring-4
1.1-M20160505-01
commons httpclient
commons httpclient
3.1
org.apache.httpcomponents
httpclient
4.5.2
org.apache.httpcomponents
httpcore
4.4.5
javax.activation
激活
1.1
javax.inject
javax.inject
1.

spring集成JDBCPOM包含

  <dependency>
      <groupId>org.springframework.integration</groupId>
      <artifactId>spring-integration-core</artifactId>
      <version>4.3.5.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>4.3.4.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>19.0</version>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>

org.springframework.integration
spring集成核心
4.3.5.1发布
编译
org.springframework
SpringJDBC
4.3.4.1发布
编译
番石榴
番石榴
19
编译
真的
spring-integration-jdbc-2.2.xsd

不要在架构导入上放置版本。它必须与您正在使用的版本(4.3)相匹配

如果您关闭该版本,Spring将为您解析正确的版本(请参阅jar中的
/META-INF/Spring.schemas


无论如何;所有内容(JAR、模式)都必须有匹配的版本

我不熟悉Spring集成,但您的错误消息似乎来自Spring,而不是“理解”什么是int jdbc:outbound channel adapter。愚蠢的问题,但是您的类路径中有Spring集成吗?如果您使用Maven,请检查pom.xml以确保它在那里。我相信是的,我将发布我的depsJust说明您正在混合Spring版本,这从来都不是一个好主意。您应该在POM中与Springframework BOM一起使用
dependencyManagement
,以确保相关性符合预期。您需要显示序言(XML文件顶部的内容);也许您没有正确定义
intjdbc
名称空间?我添加了序言,这似乎是一个很好的建议,但更改并没有解决我的问题。类路径资源[META-INF/msrb/spring int jdbc.XML]的XML文档中的第26行无效;嵌套异常为org.xml.sax.saxpasseeption;行号:26;栏目号:22;cvc complex type.2.4.c:匹配的通配符是严格的,但是找不到元素“int jdbc:outbound-gateway”的声明是运行时错误还是IDE中的标志?如果是后者,请忽略它或使用支持spring的IDE。如果是前者,则类路径仍有问题。运行时错误:/。我使用的是STS3.7,它没有标记任何东西。除了Spring集成JDBCPOM之外,我还需要包括其他东西吗?它位于我的maven依赖项列表的顶部,所以不应该覆盖任何内容。出站网关通过通道接收请求并返回回复。请参阅文档和示例应用程序。这是它使用网关的方法。
<dependencies>
    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-jdbc</artifactId>
        <version>4.3.5.RELEASE</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <version>6.0.8112.100</version>
    </dependency>
    <dependency>
        <groupId>com.companyname</groupId>
        <artifactId>spring-boot-common</artifactId>
        <version>1.0.0.COMMON-SBCOMMON-14</version>
    </dependency>
    <dependency>
        <groupId>c3p0</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.13</version>
    </dependency>


    <!-- End -->
    <dependency>
        <groupId>com.companyname</groupId>
        <artifactId>companyname-spring-core-spring-4</artifactId>
        <version>1.1-M20160505-01</version>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.4.5</version>
    </dependency>
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>
  <dependency>
      <groupId>org.springframework.integration</groupId>
      <artifactId>spring-integration-core</artifactId>
      <version>4.3.5.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>4.3.4.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>19.0</version>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>
http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd