자바(Java)
org.springframework.core.NestedIOException: Failed to parse mapping resource: 'ServleContext resource [.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNu..
xemaker
2020. 5. 13. 13:56
자바 mybatis 프로그래밍을 하다 보면 아래와 같은 에러를 만날 수 있다.
org.springframework.beans.factory.BeanCreationException: Could not autowire field:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSession' defined in ServeltContext resource
org.springframework.core.NestedIOException: Failed to parse mapping resource: 'ServleContext resource [.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: columnNumber: ; 요소 콘텐츠는 올바른 형식의 문자 데이터 또는 마크업으로 구성되어야 합니다.
보통 쿼리문에서 실행시키고 그대로 mybatis에 가져다 붙일때 많이 일어난다.
나 같은 케이스는 < 이것을 <![CDATA[<]]> 이렇게 안바꾸고 mybatis xml에다 갖다 붙였더니 위의 에러가 발생했다.
mybatis xml에서< 는 CDATA를 붙여야 된다.