Error in spring application context schema

前端 未结 14 946
借酒劲吻你
借酒劲吻你 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:11

    I removed this error by updating the version number in

      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
    

    to 4.3 as I had upadated spring version in pom as 4.3.7.RELEASE

    0 讨论(0)
  • 2020-12-30 04:12

    I recently had a similar problem in latest Eclipse (Kepler) and fixed it by disabling the option "Honour all XML schema locations" in Preferences > XML > XML Files > Validation. It disables validation for references to the same namespaces that point to different schema locations, only taking the first found generally in the XML file being validated. This option comes from the Xerces library.

    WTP Doc: http://www.eclipse.org/webtools/releases/3.1.0/newandnoteworthy/sourceediting.php

    Xerces Doc: http://xerces.apache.org/xerces2-j/features.html#honour-all-schemaLocations

    0 讨论(0)
  • 2020-12-30 04:12

    This happen to me after upgrade eclipse version. What works for me was clean the eclipse cache. Go to Window > Preferences > Network Connection > Cache > Remove All.

    I hope this works for anyone!

    0 讨论(0)
  • 2020-12-30 04:14

    use this:

    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.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/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd"
    
    0 讨论(0)
  • 2020-12-30 04:17

    I have solved it by doing 3 things:

    1. Added this repository to my POM:

      <repository>
          <id>spring-milestone</id>
          <name>Spring Maven MILESTONE Repository</name>
          <url>http://repo.springsource.org/libs-milestone</url>
      </repository>
      
    2. I'm using this version of spring-jpa:

      <dependency>
          <groupId>org.springframework.data</groupId>
          <artifactId>spring-data-jpa</artifactId>
          <version>1.2.0.RELEASE</version>
      </dependency>
      
    3. I removed the xsd versions from my context (although I'm not sure it is necessary):

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
        xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="
         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/tx http://www.springframework.org/schema/tx/spring-tx.xsd
         http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
         http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
      

    I hope this helps.

    0 讨论(0)
  • 2020-12-30 04:17

    Sometimes the spring config xml file works not well on next eclipse open up.

    It shows error in the xml file caused by schema definition, no matter reopen eclipse or clean up project are both not working.

    But try this!

    Right click on the spring config xml file, and select validate.

    After a while, the error disappears and eclipse tells you there is no error on this file.

    What a joke...

    0 讨论(0)
提交回复
热议问题