-
'dataSource' is not writable in bean class [org.springframework.orm.ibatis.SqlMapClie
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
Similar Threads
-
Replies: 26
Last Post: 12-01-2012, 04:12 AM
-
By Osiris43 in forum .NET
Replies: 1
Last Post: 08-04-2006, 12:15 PM
-
Replies: 5
Last Post: 01-15-2006, 07:10 PM
-
Replies: 5
Last Post: 10-17-2002, 01:58 PM
-
Replies: 0
Last Post: 09-22-2000, 04:35 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks