DataSource lookup through JNDI
Am new to Spring. Trying to do a JNDI lookup to obtain a reference to DataSource object.
The following is the config file that i use
<beans>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName" value="jdbc/OBUSV8" />
</bean>
<bean id="springJDBC" class="<className>">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
</beans>
When i try to access the dataSouce through JdbcTemplate class, i get the following exception
[7/6/07 8:57:57:718 GMT] 00000057 SystemOut O Setting dataSource com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource@4b23364 4
[7/6/07 8:57:57:718 GMT] 00000057 SystemOut O <classname> ->getInstance Obtained dataSource com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource@4b23364 4
[7/6/07 8:57:57:718 GMT] 00000057 SystemOut O <classname> ->getFiles Calling JdbcTemplate
[7/6/07 8:57:57:768 GMT] 00000057 SystemOut O <classname> ->getFiles Exception obtained
[7/6/07 8:57:57:798 GMT] 00000057 SystemErr R java.lang.IllegalArgumentException: Property 'dataSource' is required
at org.springframework.jdbc.support.JdbcAccessor.afte rPropertiesSet(JdbcAccessor.java:134)
at org.springframework.jdbc.core.JdbcTemplate.<init>( JdbcTemplate.java:143)
This occurs when i use JdbcTemplate
JdbcTemplate jdbc = new JdbcTemplate(getDataSource());
The DAO class has a property dataSource. What is the property 'dataSource' that is being referred to above in the exception log. The dataSource has been properly configured as i am able to obtain a connection through a initialContext.lookup method.
Would appreciate if someone could guide me on this.