The Artima Developer Community
Sponsored Link

Java Answers Forum
'dataSource' is not writable in bean class [org.springframework.orm.ibatis.

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
pius fernandez

Posts: 1
Nickname: pius
Registered: Jan, 2007

'dataSource' is not writable in bean class [org.springframework.orm.ibatis. Posted: Jan 20, 2007 12:58 PM
Reply to this message Reply
Advertisement
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>
<proper ty name="password"><value>jacer123</value></property>
</be an>

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClient FactoryBean">
<property name="configLocation"><value>/sqlmapconfig.xml</value></prope rty>
<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

Topic: 'dataSource' is not writable in bean class [org.springframework.orm.ibatis. Previous Topic   Next Topic Topic: Date insertion problem in database

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use