Multiple annotations found in spring 4.0

3.5k Views Asked by At

I am getting following error in my springconf.xml file

Multiple annotations found at this line:
- Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-4.0.xsd). For 
 more information, right click on the message in the Problems View and select "Show Details..."
- Referenced file contains errors (http://www.springframework.org/schema/context/spring-context-4.0.xsd). 
 For more information, right click on the message in the Problems View and select "Show Details..."
- Referenced file contains errors (http://www.springframework.org/schema/tool/spring-tool-4.0.xsd). For 
 more information, right click on the message in the Problems View and select "Show Details..."

My SpringConf.xml file looks like this

<?xml version="1.0" encoding="UTF-8"?>  
<beans xmlns="http://www.springframework.org/schema/beans"  
xmlns:context="http://www.springframework.org/schema/context"  
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xmlns:p="http://www.springframework.org/schema/p"    
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
xsi:schemaLocation="http://www.springframework.org/schema/beans    

http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
http://www.springframework.org/schema/data/mongo
http://www.springframework.org/schema/data/mongo/spring-mongo-1.5.xsd 
http://www.springframework.org/schema/context  
http://www.springframework.org/schema/context/spring-context-4.0.xsd">

<mongo:mongo host="com.rg.test" port="10075" />
<mongo:db-factory dbname="young-sierra" />

<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
    <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
</bean>

If I remove

<mongo:mongo host="com.rg.test" port="10075" />
<mongo:db-factory dbname="young-sierra" />

It works fine.

My all jar files in lib folder have following details. I am not sure if I am using correct version of mongo jars. Please help me if any body have idea

commons-logging-1.1.1.jar
jstl-1.2.jar
mongo-java-driver-3.0.2.jar
spring-aop-4.0.0.RELEASE.jar
spring-aspects-4.0.0.RELEASE.jar
spring-beans-4.0.0.RELEASE.jar
spring-context-4.0.0.RELEASE.jar
spring-core-4.0.0.RELEASE.jar
spring-data-commons-core-1.0.0.RELEASE(1).jar
spring-data-mongodb-1.0.0.RELEASE.jar
spring-expression-4.0.0.RELEASE.jar
spring-framework-bom-4.0.0.RELEASE.jar
spring-web-4.0.0.RELEASE.jar
spring-webmvc-4.0.0.RELEASE.jar
1

There are 1 best solutions below

0
On

Check the version of spring that the mongodb xsi:schemaLocation is referring to.

               **config file 1 schema defination**
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.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-4.2.xsd"

If the other configuration xmls specify a different spring version then you will have to update this one. Make sure that all the beans use the same schema spring version across your project. For example one bean cant have the following

                 **config file 2 Schema defination**
 xsi:schemaLocation="http://www.springframework.org/schema/mvc
 http://www.springframework.org/schema/mvc/spring-mvc-3.0.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-3.0.xsd"

living alongside with the defination 1. They both need to have the same schema properties. Hope this is clear.