Am getting the error below "Premature end of file, when calling
SqlMapClientBuilder.buildSqlMapClient(reader); The SystemOut shows all
the xml in the console, so I don't understand the error..... By the
way, this code used to work, however when I copied the files/lib in a
new project, that's when I started to get this error... any help is much
appreciated.
Thanks
Tony
Reader reader =
Resources.getResourceAsReader("/WEB-INF/config/" + resource);
System.out.println(FileIO.readerToString(reader));
alphaSqlMap =
SqlMapClientBuilder.buildSqlMapClient(reader);
[11/24/08 18:32:09:769 EST] 0000000a SystemOut O 2008-11-24
18:32:09,566 ERROR ? com.medco.imaging.common.SqlConfig -
** Exception encountered while initializing sqlMapClient.
java.lang.RuntimeException: Error occurred. Cause:
com.ibatis.common.xml.NodeletException: Error parsing XML. Cause:
org.xml.sax.SAXParseException: Premature end of file.
at
com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConf
igParser.java:89)
at
com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapCli
entBuilder.java:63)
at com.medco.imaging.common.SqlConfig.<clinit>(SqlConfig.java)
the resource file is
<?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">
<!-- Always ensure to use the correct XML Header as above -->
<sqlMapConfig>
<!-- The properties (name=value) in the file specified here
can be used placeholders in this config
file (e.g. ${driver}. The file is usually relative to the classpath and
is optional. -->
<properties
resource="WEB-INF/config/local_database.properties"/>
<settings enhancementEnabled="true"
useStatementNamespaces="true"/>
<!-- Type aliases allow you to use a shorter name for long
fully qualified class names. -->
<!-- Configure a datasource to use with this SQL Map using
SimpleDataSource.
Notice the use of the properties from the above resource -->
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver"
value="${driver}"/>
<property name="JDBC.ConnectionURL"
value="${jdbc.url.alpha}"/>
<property name="JDBC.Username"
value="${username.alpha}"/>
<property name="JDBC.Password"
value="${password.alpha}"/>
<!--
<property name="JDBC.Driver"
value="oracle.jdbc.driver.OracleDriver"/>
<property name="JDBC.ConnectionURL"
value="jdbc:oracle:thin:@//mcfl1uaq:1535/MCDBI03"/>
<property name="JDBC.Username"
value="p548oy"/>
<property name="JDBC.Password"
value="p548oy80"/>
-->
<!-- <property name="testWhileIdle"
value="true"/> -->
</dataSource>
</transactionManager>
<!-- Identify all SQL Map XML files to be loaded by this SQL
map. Notice the paths
are relative to the classpath. For now, we only have one -->
<sqlMap resource="WEB-INF/config/uv_sqlmap.xml"/>
</sqlMapConfig>
And uv_sqlmap.xml is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap>
<select id="getDocId" parameterClass="int"
resultClass="java.util.HashMap">
SELECT FILENET_DOC_ID AS id,
DOC_SIDE_CDE AS page
FROM IMAGE
WHERE FILENET_DOC_ID = #id#
</select>
<select id="getUserRoles" parameterClass="String"
resultClass="java.util.HashMap">
<!--select distinct last_nme, first_nme,
role_nme, start_dte, end_dte -->
select distinct role_nme
from up_user u, up_user_detail d,
up_user_role ur, up_role r
where u.up_user_gu_id =
d.up_user_gu_id
and u.up_user_gu_id=
ur.up_user_gu_id
and ur.up_role_gu_id =
r.up_role_gu_id
and d.racf_id= #racfid#
and u.user_status_cde='ACT'
and (end_dte>sysdate or end_dte is
null)
and r.role_status_cde='ACT'
</select>
<parameterMap id="rxlocParam" class="map">
<parameter property="rx" jdbcType="VARCHAR"
javaType="java.lang.String"/>
<parameter property="loc" jdbcType="VARCHAR"
javaType="java.lang.String"/>
</parameterMap>
<resultMap id="ImRxBean"
class="com.medco.imaging.app.alpha.ImRxBean">
<result property="docId"
column="F_DOCNUMBER_ID"/>
<result property="tiffDocId"
column="TIFF_DOC_ID"/>
<result property="docCommittalDate"
column="DOC_COMMITTAL_DTE"/>
<result property="libraryName"
column="F_LIBRARY_NAME"/>
<result property="rx" column="RXNUM_TXT"/>
<result property="loc" column="LOCATION_CDE"/>
<result property="deleteDate"
column="F_DELETE_DTE"/>
</resultMap>
<select id="getEISPolyScript" parameterMap="rxlocParam"
resultMap="ImRxBean">
SELECT F_DOCNUMBER_ID,
TIFF_DOC_ID,
DOC_COMMITTAL_DTE,
F_LIBRARY_NAME,
RXNUM_TXT,
LOCATION_CDE,
F_DELETE_DTE
FROM IM_RX rx, IM_FILENET_LIBRARY lib
WHERE rx.F_LIBRARY_ID = lib.F_LIBRARY_ID
AND RXNUM_TXT = ?
AND LOCATION_CDE = ?
</select>
</sqlMap>
This e-mail message and any attachments contain confidential
information from Medco. If you are not the intended recipient, you
are hereby notified that disclosure, printing, copying,
distribution, or the taking of any action in reliance on the
contents of this electronic information is strictly prohibited. If
you have received this e-mail message in error, please immediately
notify the sender by reply message and then delete the electronic
message and any attachments.