ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Multiple annotations found at this line 에러
    Spring/Spring Quick Start 2019. 2. 14. 19:27


    |컴포넌트 스캔 설정

    컴포넌트 스캔 설정하기 위해서 applicationContext.xml에서 설정해주는데 다음과 같은 에러 발생했다.


    |xml 설정

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

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

    <context:component-scan base-package="polymorphism"></context:component-scan>




    |에러문구


    Multiple annotations found at this line:

    - schema_reference.4: Failed to read schema document 'http://www.springframework.org.schema/context/spring-context-4.2.xsd', because 1) could not 

    find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

    - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'. 


    |에러 문장확인


    1) could not find the document;

    --> 문서를 찾을수 없다

    2) the document could not be read;

    --> 문서를 읽을 수 없다.

    3) the root element of the document is not <xsd:schema>.- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'. 

    -->선언을 찾을수 없다.



    |에러해결

    참조블로그 - 링크1


    |해결방법

    안보일시 사진 클릭하면 확대가능



    applicationContext.xml에서 생긴 문제이므로 여기서 해결하면 될것으로 보았고, 

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

    이 부분이 제대로 동작안하는것 같았다. 따라서, 이 부분이 제대로 동작하게끔 몇가지 해주었다.

    1. 프로젝트 클린 

    -> 뭐가 안되면 가장 먼저 해보는것중 하나다. 간단하고 사소하지만, 이걸로 해결되는 경우가 많았다.

    2. namespace 확인 

    -> (결과적으로 이게 맞았다)

    --> applicaitonContext.xml -> namespaces 클릭 -> Configure Namespaces에 context 체크 확인 -> context의 Namespaces 버전확인. 


    버전확인을 한 이유는, context-4.2xsd라는 버전으로 설정해주었는데, 실제로는 다른 버전으로 인식되고 있으면에러가 날 확률이 높다. 따라서, 위 과정을 거치면 해결될 확률이 높다.




    'Spring > Spring Quick Start' 카테고리의 다른 글

    H2database 1.4.197 설치 및 구동  (0) 2019.04.28
    톰캣 8.0.32 설치  (0) 2019.04.27
    eclipse mars 버전 설치  (0) 2019.04.27
    JDK1.8 설치 및 환경변수 설정  (0) 2019.04.27
    [스프링퀵스타트] 1일차  (0) 2019.01.29

    댓글

© 2018 T-Story. All right reserved.