【发布时间】: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