Hello

I am trying to do a simple query in the database using Object/Relational Mapping wiht iBatis SqlMapClientFactoryBean and seting it up in Spring applicationContext.xml

and i am getting the following error Message

Error creating bean with name 'sqlMapClient' defined in (no description): Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Property 'dataSource' is not writable in bean class [org.springframework.orm.ibatis.SqlMapClientFactory Bean]
Exception in thread "main" java.lang.NullPointerException
at com.prac.elh.client.ELHClient.hpService(ELHClient. java:22)
at com.prac.elh.client.ELHClient.main(ELHClient.java: 946)


Account.xml
------------
<?xml version="1.0" encoding="UTF-8"?>
<sqlMap namespace="Account">
<resultMap id="accountResult" class="com.prac.elh.domain.Account">
<result property="username" column="POLICY_NBR_X_UPPR"/>
<result property="policyid" column="REJECT_REASON_C"/>
<result property="policynbr" column="POLICY_NBR_X"/>
</resultMap>
<select id="getAccountByPolicynbr" resultMap="accountResult"
parameterClass="string">
select
POLICY_NBR_X_UPPR,
REJECT_REASON_C,
POLICY_NBR_X
from POLICY.POL_POLICY
where POLICY_NBR_X = #value#
</select>
</sqlMap>


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName"><value>COM.ibm.db2.jdbc.app .DB2Driver</value></property>
<property name="url"><value>jdbc:db2:ABCD0R1R</value></property>
<property name="username"><value>proty</value></property>
<property name="password"><value>jacer123</value></property>
</bean>

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClient FactoryBean">
<property name="configLocation"><value>/sqlmapconfig.xml</value></property>
<property name="dataSource"><ref bean="dataSource"/></property>
</bean>

<bean id="hpServiceDao" class="com.prac.elh.model.dao.impl.HPServiceDaoJdb c">
<property name="sqlMapClient"><ref bean="sqlMapClient"/></property>
</bean>

<bean id="elhConfigReader" class="com.prac.elh.model.util.ElhConfigReader"/>

<bean id="hpService" class="com.prac.elh.model.service.impl.HPServiceIm pl">
<property name="elhConfigReader"><refbean="elhConfigReader"/></property>
<property name="hpServiceDao"><ref bean="hpServiceDao"/></property>
</bean>

</beans>

On trying to locate the hpService bean, i get the above mentioned error

Please if someone can guide me on what is that i am doing wrong it would be very helpful
Also i you have had a similar problem please share your experience

Regards,
Pius