Announcement Announcement Module
Collapse
No announcement yet.
unable to parse spring rabbit integration XML file (connection-factory @hosts) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • unable to parse spring rabbit integration XML file (connection-factory @hosts)

    Hi,

    I have a project where I am trying to set up amqp-spring. I have tho following namespace at the top of my spring xml file:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:rabbit="http://www.springframework.org/schema/rabbit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="
    	http://www.springframework.org/schema/rabbit 
    	http://www.springframework.org/schema/rabbit/spring-rabbit-1.1.xsd	
    	http://www.springframework.org/schema/beans 	
    	http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    	">
    This is where I am trying to declare the connection factory

    Code:
    	<rabbit:connection-factory id="rabbitConnectionFactory" addresses="taupoc1-agct:5672,taupoc2-agct:5672,taupoc3-agct:5672" />
    I have the following dependencies set up in maven:

    Code:
    <dependency>
    			<groupId>org.springframework.amqp</groupId>
    			<artifactId>spring-amqp</artifactId>
    			<version>${versions.spring.integration.amqp}</version>
    			<exclusions>
    				<exclusion>
    					<artifactId>spring-core</artifactId>
    					<groupId>org.springframework</groupId>
    				</exclusion>
    			</exclusions>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-context</artifactId>
    			<version>${versions.springframework}</version>
    		</dependency>
    		<dependency>
    			<groupId>com.rabbitmq</groupId>
    			<artifactId>amqp-client</artifactId>
    			<version>${versions.rabbitmq}</version>
    		</dependency>
    When I try to run this app, as spring is loading the XML file I get this error:

    Code:
    Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/rabbit]
    Offending resource: class path resource [springConfig.xml]
    
    	at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
    ...
    I think part of the problem is the fact that I am referencing the spring-rabbit-1.1.xsd instead of 1.0 (I do this because I need access to the addresses attribute in connection-factory.

    How can I resolve this issue? Am I missing a dependency or something?

  • #2
    I think you need to declare spring-rabbit as a dependency too.

    Code:
    <dependency>
                <groupId>org.springframework.amqp</groupId>
                <artifactId>spring-rabbit</artifactId>
                <version>1.1.1.RELEASE</version>
    </dependency>
    AJ

    Comment

    Working...
    X