2021년 11월 10일 수요일

spring-beans.xsd 읽기를 실패 오류

윈도우가 지 맘데로 리부팅 후 이클립스가 이상해졌다
서버를 구동하니 못보던 오류가 뜬다.

2021-11-11 11:10:27 INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
2021-11-11 11:10:27 WARN : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Ignored XML validation warning
org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 129; schema_reference.4: 스키마 문서 'https://www.springframework.org/schema/beans/spring-beans.xsd' 읽기를 실패했습니다. 원인: 1) 문서를 찾을 수 없습니다. 2) 문서를 읽을 수 없습니다. 3) 문서의 루트 요소가 가 아닙니다.

이것 저것 해보다가 우연히 아래처럼 고쳐서 문제는 해결된다.


root-context.xml
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
    ...생략...
</beans>


이렇게 변경했다
변경전 https://www.springframework.org/schema/beans/spring-beans.xsd 변경후 http://www.springframework.org/schema/beans/spring-beans.xsd

servlet-context.xml
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
        ...생략...
</beans:beans>


변경전
https://www.springframework.org/schema/mvc/spring-mvc.xsd
https://www.springframework.org/schema/beans/spring-beans.xsd
https://www.springframework.org/schema/context/spring-context.xsd

변경후
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context/spring-context.xsd

프로토콜을 저렇게 바꾸니 된다니 말도 안되고 옳은 방법도 아닌것 같다.
일단 되니까 그냥 넘어간다.