here is the app_beans_test.sql:
.....
<!-- ============== iBATIS Definitions ============= -->
<!-- SqlMap setup for iBATIS Database Layer -->
<bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property
name="configLocation"><value>WEB-INF/test/sql-map-config_test.xml</value></property>
</bean>
<!-- ============== iBATIS Definitions ============= -->
......
and here is the sql-config_test.xml:
<?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">
<!-- Custom Type Handlers -->
<sqlMapConfig>
<typeHandler javaType="edu.umich.med.umms.util.MSDate"
callback="edu.umich.med.umms.util.typehandler.MSDateTypeHandler"/>
<typeHandler javaType="edu.umich.med.umms.util.MSMonthYearDate"
callback="edu.umich.med.umms.util.typehandler.MSMonthYearDateTypeHandler"/>
<typeHandler javaType="edu.umich.med.umms.util.MSMoney"
callback="edu.umich.med.umms.util.typehandler.MSMoneyTypeHandler"/>
<sqlMap resource="edu/umich/med/umms/mtrain/dao/ibatis_map/misc.xml"/>
.....
Remember, all files work fine in the web app. Errors only occurs during
the JUnit testing.
-Henry
Brocard Antoine wrote:
Hi,
Can you provide us the app_beans_test.xml file?
Antoine
-----Original Message-----
From: Henry Lu [mailto:[EMAIL PROTECTED]
Sent: vendredi, 28. juillet 2006 13:52
To: [email protected]
Subject: error...
I run a Junit testing and got the following errors:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'sqlMapClient' defined in file
[C:\devel\webapps\mtrain\WEB-INF\test\app_beans_test.xml]:
Initialization of bean failed; nested exception is
com.ibatis.common.exception.NestedRuntimeException: Error occurred.
Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.
Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing
XPath '/sqlMapConfig/sqlMap'. Cause:
com.ibatis.common.xml.NodeletException: Error parsing XML. Cause:
org.xml.sax.SAXParseException: Attribute "namespace" must be declared
for element type "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "namespace" must be
declared for element type "sqlMap".
But my web application runs with all mao file and doesn't have any
errors. The Error occurs only in the JUnit testing.
Any Idea?
-Henry
[EMAIL PROTECTED] wrote:
Hi Aram,
Still I am getting NullPointerException. I am unable to find the
problem.
The following is the ErrorDescription
--------------------------------------------------------
--- The error occurred while applying a result map.
--- Check the User.userMapForStaticAndDynamicRamBabu.
--- Check the result mapping for the '*properties*' property.
--- Cause: java.lang.NullPointerException
Thanks n Regards,
=============================
Rambabu Piridi.
------------------------------------------------------------------------
*From:* Mkhitaryan, Aram [mailto:[EMAIL PROTECTED]
*Sent:* Friday, July 28, 2006 9:50 AM
*To:* [email protected]
*Subject:* RE: Need help---Mapping of Complex properties
<result property="properties" column="USR_ID"
select="RamBabuExtension" />
You missed also column attribute.
Also use USR_ID=#value# instead of USR_ID=#usr_id#
Add this and try again.
Best,
Aram
------------------------------------------------------------------------
*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
*Sent:* Friday, July 28, 2006 9:07 AM
*To:* [email protected]
*Subject:* RE: Need help---Mapping of Complex properties
<resultMap id="userMapForStaticAndDynamicRamBabu" class="user"
groupBy="userid">
<result property="userid" column="USR_ID"/>
<result property="username" column="USR_NAME"/>
<result property="role" column="ROLE_ID"/>
<result property="description" column="DESCRIPTION"/>
<result property="properties" select="RamBabuExtension" />
</resultMap>
<resultMap id="userExtensionMapForStaticAndDynamicRamBabu"
class="UserProperty">
<result property="propertyname" column="PROPERTY_NAME"/>
<result property="propertyvalue" column="PROPERTY_VALUE"/>
</resultMap>
<statement id="RamBabu" resultMap="userMapForStaticAndDynamicRamBabu">
select * from USR_BASIC_INFO
</statement>
<statement id="RamBabuExtension"
resultMap="userExtensionMapForStaticAndDynamicRamBabu">
select * from USR_EXTENSION_INFO where USR_ID=#usr_id#
</statement>
Thanks n Regards,
==============
Rambabu Piridi.
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
addressee(s) and may contain proprietary, confidential or privileged
information. If you are not the intended recipient, you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately and destroy all copies of this message and any
attachments.
WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of
viruses. The company accepts no liability for any damage caused by any
virus transmitted by this email.
www.wipro.com
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
addressee(s) and may contain proprietary, confidential or privileged
information. If you are not the intended recipient, you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately and destroy all copies of this message and any
attachments.
WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of
viruses. The company accepts no liability for any damage caused by any
virus transmitted by this email.
www.wipro.com