Reputation: 43
**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.
Below is my Spring context file which I am using and I have defined all the beans. :
<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)
The application is working for all the other xml schema document except Rabbit mq.I have tried changing rabbitmq schema document version as well but it seems none of them is working.
Edit: I am not using maven. I have included spring-rabbit-2.0.jar in my classpath. enter image description here
Upvotes: 3
Views: 313
Reputation: 174729
What version of spring-rabbit?
I suspect it's not 1.6.x.
Best practice is to not use versioned schemas and Spring will the resolve the correct version based on the spring.schemas
in the META-INF in the jar.
Use http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
and spring-jms.xsd
.
Upvotes: 0