복붙노트

[SPRING] 스프링 응용 프로그램 컨텍스트 스키마의 오류

SPRING

스프링 응용 프로그램 컨텍스트 스키마의 오류

이클립스에서 maven-spring 프로젝트를 가지고 있고 내 봄 컨텍스트 중 하나에서이 성가신 오류 메시지가 있습니다.

쇼 세트는 다음과 같이 연결됩니다.

나는 spring-data-jpa 1.2.0.RELEASE를 사용하고 나머지 Spring Jar는 3.1.3.RELEASE입니다. spring-data-commons-core에 대해서 - 나는이 par에이 jar에 대한 의존성조차 갖고 있지 않지만 spring-data-commons-parent와 함께 m2 저장소에서 볼 수있다. 1.4.0.RELEASE , 왜 그런지는 모르겠다. (어쩌면 그것들은 봄 데이터의 일부분인가?).

내 응용 프로그램 컨텍스트 스키마 :

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

내가 왜이 오류를 계속 이해하는지 모르겠다. 기본적으로 그것은 아무런 영향을 미치지 않습니다. 앱이 컴파일되고 배포되며 잘 실행됩니다. 이클립스에서이 미친 빨간색 오류 표시가 나를 미치게합니다. :)

해결법

  1. ==============================

    1.필자는 최근에 최신 Eclipse (Kepler)에서 비슷한 문제가 있었으며 환경 설정> XML> XML 파일> 유효성 검사에서 "모든 XML 스키마 위치를 존중하십시오"옵션을 비활성화하여 문제를 해결했습니다. 다른 스키마 위치를 가리키는 동일한 네임 스페이스에 대한 참조에 대한 유효성을 비활성화합니다. 일반적으로 유효성이 검사되는 XML 파일에서 처음으로 발견 된 것만 가져옵니다. 이 옵션은 Xerces 라이브러리에서 가져옵니다.

    필자는 최근에 최신 Eclipse (Kepler)에서 비슷한 문제가 있었으며 환경 설정> XML> XML 파일> 유효성 검사에서 "모든 XML 스키마 위치를 존중하십시오"옵션을 비활성화하여 문제를 해결했습니다. 다른 스키마 위치를 가리키는 동일한 네임 스페이스에 대한 참조에 대한 유효성을 비활성화합니다. 일반적으로 유효성이 검사되는 XML 파일에서 처음으로 발견 된 것만 가져옵니다. 이 옵션은 Xerces 라이브러리에서 가져옵니다.

    WTP 문서 : 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

  2. ==============================

    2.나는 3 가지 일을함으로써 그것을 해결했다.

    나는 3 가지 일을함으로써 그것을 해결했다.

    이게 도움이 되길 바란다.

  3. ==============================

    3.내가 spring-data-jpa-1.3으로 한 것은 xsd에 버전을 추가하고 1.2로 낮췄다. 그런 다음 오류 메시지가 사라집니다. 이처럼

    내가 spring-data-jpa-1.3으로 한 것은 xsd에 버전을 추가하고 1.2로 낮췄다. 그런 다음 오류 메시지가 사라집니다. 이처럼

    <beans
            xmlns="http://www.springframework.org/schema/beans"
            ...
            xmlns:jpa="http://www.springframework.org/schema/data/jpa"
            xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        ...
        http://www.springframework.org/schema/data/jpa
        http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd">
    

    1.2에서 수정 된 것처럼 보이지만 1.3에서 다시 나타납니다.

  4. ==============================

    4.나는 최근 Spring 4.0에서 같은 문제를 겪었다.

    나는 최근 Spring 4.0에서 같은 문제를 겪었다.

    이것은 spring-beans-4.0.xsd와 spring-context-4.0.xsd의 충돌로 인해 발생했습니다. Spring-context-4.0.xsd를 열면 다음과 같이 spring-beans-4.0.xsd를 가져올 수있다.

    <xsd:import namespace="http://www.springframework.org/schema/beans"  
    schemaLocation="http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"/>
    

    이러한 이름의 충돌로 인해 Eclipse가 "... 같은 이름의 두 글로벌 구성 요소를 스키마에 포함 할 수 없습니다 ..."

    주목할만한 점은 필자는 Eclipse Kepler SR2에서이 문제가 없었지만 Eclipse Luna SR1에서 XML 유효성 검사에 대한 두 가지 기본 설정을 모두 비교했다는 점입니다.

    xsi : schemaLocation 속성에서 spring-context-4.0.xsd를 제거하여 해결되었습니다.

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

    그 후 모든 것이 예상대로 작동했습니다.

  5. ==============================

    5.때때로 spring config xml 파일은 다음 Eclipse가 열리지 않을 때 잘 작동합니다.

    때때로 spring config xml 파일은 다음 Eclipse가 열리지 않을 때 잘 작동합니다.

    그것은 스키마 정의에 의해 발생하는 xml 파일의 오류를 보여 주며, Eclipse 또는 프로젝트를 다시 열지 않아도 작동하지 않습니다.

    그러나 이것을 시도하십시오!

    잠시 후 오류가 사라지고 eclipse가이 파일에 오류가 없음을 알립니다.

    좋은 농담 이었어...

  6. ==============================

    6.최근에 JPA-1.3과 동일한 문제가 발생했습니다.

    최근에 JPA-1.3과 동일한 문제가 발생했습니다.

    명백한 tools.xsd 링크를 사용할 때까지 아무 것도 작동하지 않았습니다.

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

    이렇게 :

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:p="http://www.springframework.org/schema/p" 
        xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:jdbc="http://www.springframework.org/schema/jdbc"
        xmlns:jpa="http://www.springframework.org/schema/data/jpa"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
            http://www.springframework.org/schema/tx 
            http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
            http://www.springframework.org/schema/jdbc 
            http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
            http://www.springframework.org/schema/data/jpa
            http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
            http://www.springframework.org/schema/tool
            http://www.springframework.org/schema/tool/spring-tool-3.2.xsd
            ">
    
  7. ==============================

    7.@forhas와 @HRgiger가 나를 위해 일한 것은 무엇입니까? 나는 jpa 대신에 spring-data-mongodb를 사용하고있다.

    @forhas와 @HRgiger가 나를 위해 일한 것은 무엇입니까? 나는 jpa 대신에 spring-data-mongodb를 사용하고있다.

    그러나 mongodb 바인딩의 경우 mongodb 참조 xsd의 버전을 제거하지 말고 http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd 버전으로 유지하십시오. 컨텍스트 및 Bean 버전을 제거해야합니다.

  8. ==============================

    8.버전 번호를 업데이트하여이 오류를 제거했습니다.

    버전 번호를 업데이트하여이 오류를 제거했습니다.

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

    4.3으로 pom에서 스프링 버전을 업데이트 했으므로 4.3으로 릴리즈합니다.

  9. ==============================

    9.이것을 사용하십시오 :

    이것을 사용하십시오 :

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

    10.또한이 문제에 직면하여 XSD 이름에서 버전 부분을 제거하여 문제를 해결했습니다.

    또한이 문제에 직면하여 XSD 이름에서 버전 부분을 제거하여 문제를 해결했습니다.

    http://www.springframework.org/schema/beans/spring-beans-4.2.xsd to http://www.springframework.org/schema/beans/spring-beans.xsd
    

    XSD보다 적은 버전은 응용 프로그램에서 사용되는 프레임 워크의 현재 버전에 매핑됩니다.

  11. from https://stackoverflow.com/questions/13693065/error-in-spring-application-context-schema by cc-by-sa and MIT license