【问题标题】:Spring Integration http outbound-gatewaySpring集成http出站网关
【发布时间】:2014-06-08 04:30:11
【问题描述】:

我正在尝试使用 Spring Integration http 出站网关,但我似乎遇到了与架构相关的错误。错误是:

cvc-complex-type.3.2.2: Attribute 'expected-response-type' is not allowed to appear in element 'int-http:outbound-gateway'. sprint-servlet.xml  /sprint/src/main/webapp/WEB-INF line 28
cvc-complex-type.3.2.2: Attribute 'url' is not allowed to appear in element 'int-http:outbound-gateway'.    sprint-servlet.xml  /sprint/src/main/webapp/WEB-INF line 28
cvc-complex-type.3.2.2: Attribute 'http-method' is not allowed to appear in element 'int-http:outbound-gateway'.    sprint-servlet.xml  /sprint/src/main/webapp/WEB-INF line 28
cvc-complex-type.3.2.2: Attribute 'reply-timeout' is not allowed to appear in element 'int-http:outbound-gateway'.  sprint-servlet.xml  /sprint/src/main/webapp/WEB-INF line 28

XSD 似乎不接受这些属性。但是,我只是从 Spring Integration 文档中复制/粘贴了它。这是我的 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:int="http://www.springframework.org/schema/integration"
xmlns:int-http="http://www.springframework.org/schema/integration/http"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
                    http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
                    http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http.xsd
                    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
                    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">



<!-- Spring Integration stuff -->
<int:channel id="requests">
</int:channel>
<int:channel id="replies"/>

<int-http:outbound-gateway id="example"
  request-channel="requests"
  url="http://localhost/test"
  http-method="POST"
  expected-response-type="java.lang.String"
  charset="UTF-8"
  reply-timeout="1234"
  reply-channel="replies"/>

有什么明显的我做错了吗?

谢谢, 蒂姆

【问题讨论】:

  • 是 STS 的问题还是应用程序运行后的问题?并确保使用正确的 Spring Integration 版本:projects.spring.io/spring-integration
  • 您需要将 Spring Integration jar 放在您的类路径(http 和核心)中。
  • 我尝试过产生同样的问题,但发现错误仅针对“回复超时”属性。
  • 对了,你用的是哪个版本的spring集成?
  • 大家好,我正在使用以下版本的 Spring - 3.0.2.RELEASE。当我尝试创建一个基于 Java 的应用程序(也称为“main”)时,我收到了 XSD 错误,因此我不得不关闭验证。

标签: xsd schema spring-integration


【解决方案1】:

spring-integration-httpspring-integration-core 添加到您的依赖项中。

应该工作

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,在这里找到了答案 Why does Spring Integration have several XML schemas, and which one should I use?

    基本上,没有版本的架构是版本 1.0 架构。将您的架构指向您的 Spring 集成版本,就像这样

     http://www.springframework.org/schema/integration
     http://www.springframework.org/schema/integration/spring-integration-4.1.xsd
     http://www.springframework.org/schema/integration/http
     http://www.springframework.org/schema/integration/http/spring-integration-http-4.1.xsd
    

    【讨论】:

      【解决方案3】:

      我没有使用 STS - 我使用的是标准的 Eclipse IDE。我不确定 STS 是否有助于类路径,但我根本无法让它为我工作。我最终不得不从 .jar 文件中提取 XSD 并自己托管它们。希望 Spring Integration 的好心人很快会在 Spring 站点上发布最新的 XSD。然而,在那之前,我已经有了一个解决方法。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-03-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-06-08
        相关资源
        最近更新 更多