Hi,
I am trying to run a Hibernate application using spring framework in Rational Application Developer 7.0/Websphere 6.1. I have the following statement in the client class that loads app context:
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(new
String[] {"springexample-hibernate.xml"
});
In the springexample-hibernate.xml, I have a bean where I have specified JNDI name for the datasource that I setup on websphere 6.1.
<bean<br /> id="customerJndiDatasource"<br /> class="org.springframework.jndi.JndiObjectFactoryBean">
<property<br /> name="jndiName"<br /> value="jdbc/customer" />
<property<br /> name="lookupOnStartup"<br /> value="false" />
<property<br /> name="proxyInterface"<br /> value="javax.sql.DataSource" />
</bean>
This is rest of beans in springexample-hibernate.xml.
<bean<br /> id="exampleSessionFactory"<br /> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property<br /> name="dataSource"<br /> ref="customerJndiDatasource" />
<property name="mappingResources">
<list>
<value>hbm/customer.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
< !-- Pass the session factory to our UserDAO -->
<bean id="customerDAOTarget" class="springexample.CustomerDAOImpl">
<property name="sessionFactory"><ref local="exampleSessionFactory"/></property>
</bean>
When I run the client, it throws this error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exampleSessionFactory' defined in class path resource [daoBeanCfg.xml]: Invocation of init method failed; nested exception is org.springframework.jndi.JndiLookupFailureException: JndiObjectTargetSource failed to obtain new target object; nested exception is com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is java.lang.reflect.InvocationTargetException]
Caused by: com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException: DSRA8050W: Unable to find the DataStoreHelper class specified: com.ibm.websphere.rsadapter.WSConnectJDBCDataStoreHelper
Caused by: java.lang.ClassNotFoundException: com.ibm.websphere.rsadapter.WSConnectJDBCDataStoreHelper
I am using websphere embedded ConnectJDBC driver for MS SQL Server.
Please provide your suggestion.
Thanks,
Mallika