헤르메스 LIFE

[Exception] org.xml.sax.SAXParseException 본문

Exception

[Exception] org.xml.sax.SAXParseException

헤르메스의날개 2020. 11. 20. 03:36
728x90

[Exception] Mybatis 비교연산자, 부등호 (<, >, <=, >=, &) 오류

INFO  f.f.m.RefreshableSqlSessionFactoryBean.a (SourceFile:221) - modified files : [file [C:\MYPRJ\work-kepler\MYPRJ\WebContent\WEB-INF\classes\modules\etax\tax\IssuServiceImpl_SQL.xml]]
 
INFO  f.f.m.RefreshableSqlSessionFactoryBean.refresh (SourceFile:87) - refreshing SqlSessionFactory.
 
ERROR f.f.m.RefreshableSqlSessionFactoryBean.run (SourceFile:127) - caught exception
 org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\MYPRJ\work-kepler\MYPRJ\WebContent\WEB-INF\classes\modules\etax\tax\IssuServiceImpl_SQL.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 726; columnNumber: 30; The content of elements must consist of well-formed character data or markup.
       at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:466)
       at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
       at foren.framework.mybatis.RefreshableSqlSessionFactoryBean.refresh(SourceFile:93)
       at foren.framework.mybatis.RefreshableSqlSessionFactoryBean$2.run(SourceFile:125)
       at java.util.TimerThread.mainLoop(Timer.java:555)
       at java.util.TimerThread.run(Timer.java:505)
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 726; columnNumber: 30; The content of elements must consist of well-formed character data or markup.
       at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:256)
       at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:125)
       at org.apache.ibatis.builder.xml.XMLMapperBuilder.<init>(XMLMapperBuilder.java:78)
       at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:462)
       ... 5 common frames omitted
Caused by: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
       at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
       at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
       at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
       at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
       at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
       at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
       at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
       at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
       at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:254)
       ... 8 common frames omitted

해결방법

<![CDATA[  ]]> 태그를 이용하면 된다. 태그 사이에 아래와 같이 비교연산자를 넣어서 추가하면 에러가 발생하지 않고 정상적으로 처리 되는 것을 확인 할 수 있다.

DELETE
  FROM MSTR_TEMP
 WHERE ADD_DATE <![CDATA[<]]> CONVERT(VARCHAR(8), GETDATE(), 112)
;
728x90