2015-06-13 51 views
4

我得到我的springconf.xml文件以下錯誤多個批註4.0

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..." 

我SpringConf.xml文件看起來像這樣

<?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> 

如果我刪除

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

它工作正常。

我在lib文件夾中的所有jar文件具有以下細節。我不確定我是否使用了mongo罐子的正確版本。請幫助我,如果有任何機構有想法

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 
+0

我仍在尋找,如果有人有它的解決方案。如果我需要添加其他jar版本,請分享 – sangita

回答

0

檢查mongodb xsi:schemaLocation引用的spring的版本。

   **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" 

如果其他配置xmls指定不同的彈簧版本,那麼你將不得不更新這一個。確保所有bean在您的項目中使用相同的模式彈簧版本。例如,一個豆類食物有以下幾種:

    **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" 

與定義1一起生活。它們都需要具有相同的模式屬性。希望這是明確的。