Error in spring application context schema

前端 未结 14 1065
借酒劲吻你
借酒劲吻你 2020-12-30 04:03

I have a maven-spring project in Eclipse and I have this annoying error message in one of my spring contexts:

Referenced file contains errors (jar:fil

14条回答
  •  难免孤独
    2020-12-30 04:17

    I recently had same issue with Spring 4.0.

    It was caused by a collision in names from spring-beans-4.0.xsd and spring-context-4.0.xsd. Opening spring-context-4.0.xsd you can see that spring-beans-4.0.xsd is imported like follow:

    
    

    These name's collisions make Eclipse complain about "...A schema cannot contain two global components with the same name..."

    A noteworthy aspect is that I hadn't this problem with Eclipse Kepler SR2 but Eclipse Luna SR1, comparing both preferences about XML Validation, they were the same.

    It was solved by removing spring-context-4.0.xsd from xsi:schemaLocation attribute:

    http://www.springframework.org/schema/context   
    http://www.springframework.org/schema/context/spring-context-4.0.xsd
    

    After this everything worked as expected.

提交回复
热议问题