测试工程执行,遇到sql-mapconfig-2.dtd文件不存在的问题

[persistence/sql-map-.xml]; nested exception is java.io.FileNotFoundException: class path resource [sql-map-config-2.dtd] cannot be opened because it does not exist

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:416)

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)

at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)

at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)

at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:174)

... 35 more

Caused by: java.io.FileNotFoundException: class path resource [sql-map-config-2.dtd] cannot be opened because it does not exist

at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143)

at org.springframework.beans.factory.xml.ResourceEntityResolver.resolveEntity(ResourceEntityResolver.java:98)

at org.apache.xerces.util.EntityResolverWrapper.resolveEntity(Unknown Source)

at org.apache.xerces.impl.XMLEntityManager.resolveEntity(Unknown Source)

at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.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)



发现我原来的XML配置是:

<?xml version="1.0" encoding="GB2312"?>

<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "sql-map-config-2.dtd">


将其改成: 

<?xml version="1.0" encoding="GB2312"?>

<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

即可解决。

测试工程执行,遇到sql-mapconfig-2.dtd文件不存在的问题

上一篇:Oracle 中 for update 和 for update nowait 的区别


下一篇:oracle游标(一)