我有一个 sqlMapConfig.xml,其中定义了三个 SQLMap。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<!-- Statement namespaces are required for Ibator -->
<settings enhancementEnabled="true" useStatementNamespaces="true"/>
<!-- Setup the transaction manager and data source that are
appropriate for your environment
-->
<transactionManager type="JDBC">
<dataSource type="SIMPLE" >
<property name="JDBC.Driver"
value="com.mysql.jdbc.Driver"/>
<property name="JDBC.ConnectionURL"
value="jdbc:mysql://localhost:3306/sug"/>
<property name="JDBC.Username"
value="root"/>
<property name="JDBC.Password"
value="admin"/>
</dataSource>
</transactionManager>
<!-- SQL Map XML files should be listed here -->
<sqlMap resource="com/tatakelabs/dbmaps/categories_SqlMap.xml" />
<sqlMap resource="com/tatakelabs/dbmaps/pro_SqlMap.xml" />
<sqlMap resource="com/tatakelabs/dbmaps/pro_category_SqlMap.xml" />
</sqlMapConfig>
我收到运行时错误 - 原因:java.io.IOException:找不到资源 com/tatakelabs/dbmaps/categories_SqlMap.xml
categories_SqlMap.xml 存在于该位置。我尝试更改地图 xml 的位置,但这并没有帮助。sqlMapConfig.xml 根据 DTD 进行验证。categories_SqlMap.xml 还根据正确的 DTD 进行验证。我束手无策,试图弄清楚为什么它找不到资源。sqlMap 文件由 iBator 生成。