Spring RabbitMQ 无法读取架构文档

标签 spring spring-rabbit

**Spring not able to read XML Schema document for rabbit MQ**

I am trying to run Spring MDP application on windows 8 using Java 8.
I have configured spring file and defined xml schema document for rabbitMQ. 

下面是我正在使用的 Spring 上下文文件,我已经定义了所有 bean。 :

<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:context="http://www.springframework.org/schema/context"
xmlns:jms="http://www.springframework.org/schema/jms"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xsi:schemaLocation="http://www.springframework.org/schema/rabbit    http://www.springframework.org/schema/rabbit/spring-rabbit-1.6.xsd
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jms 
http://www.springframework.org/schema/jms/spring-jms-4.0.xsd">

I am getting error when trying to start the application  :

org.xml.sax.SAXParseException; lineNumber: 159; columnNumber: 64; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/rabbit/spring-rabbit-1.6.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
   at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
   at org.apache.xerces.util.ErrorHandlerWrapper.warning(Unknown Source)
   at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
  Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) 
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)

该应用程序适用于除 Rabbit mq 之外的所有其他 xml 模式文档。我也尝试过更改 rabbitmq 模式文档版本,但似乎它们都不起作用。

编辑: 我没有使用行家。我在类路径中包含了 spring-rabbit-2.0.jar。输入图像描述 here

最佳答案

什么版本的 spring-rabbit?

我怀疑它不是 1.6.x。

最佳实践是不使用版本化模式,Spring 将根据 jar 中的 META-INF 中的 spring.schemas 解析正确的版本。

使用http://www.springframework.org/schema/rabbit/spring-rabbit.xsd

spring-jms.xsd

关于Spring RabbitMQ 无法读取架构文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54424181/

相关文章:

java.lang.NoClassDefFoundError : org/springframework/transaction/interceptor/TransactionInterceptor 错误

java - 使用 hibernate 和 spring 将持久对象的字符串集合加载到模型中

java - Spring LdapContextSource 忽略 SSLSocketFactory

spring boot 配置属性不起作用

java - 使用 @SentTo 通过 Spring Boot 和 RabbitMq 发送消息

java - 通过一个 spring-rabbit 服务中的一个消费者同时处理多个 amqp 消息

java - 如何在 spring 中将模型作为重定向属性传递

java - 重新创建springrabbitCachingConnectionFactory的所有连接

java - RabbitMQ 固定回复和消费者配置

java - 在 RabbitMQ 中检索队列的参数和属性