Hi,
I m using JUnit 3.8. I get the following error:

java.lang.IllegalStateException: Failed to load ApplicationContext
Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in class path resource [com/bt/voonit/controller/testOrgSummaryController-context.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'dataSource' defined in class path resource [com/bt/voonit/controller/testOrgSummaryController-context.xml]: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError

This is the datasource bean in testOrgSummaryController-context.xml. Connection is tested and is working fine.

Code:
 
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName">
            <value>jdbc/voonds1</value>
        </property>
    </bean>
Code is given below.


Code:
package com.bt.voonit.controller;
 
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import com.bt.voonit.entity.Organization;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
 
@ContextConfiguration 
 
public class testOrgSummaryController extends AbstractJUnit38SpringContextTests 
{
    MockHttpServletRequest request;
    private OrganizationSummaryController org_cont;
    ModelAndView mav;
 
 
    public void testInvokesCorrectMethodWithSession() throws Exception 
    {
        try
        {
            OrganizationSummaryController org_cont = new OrganizationSummaryController();
            request = new MockHttpServletRequest("GET", "/OrganizationSummary.htm");
            mav = org_cont.handleRequest(request, new MockHttpServletResponse());
            Organization org = (Organization) org_cont.formBackingObject(request);
            assertEquals(org.getSearchFilter(),"Y");
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
        }
    }
}
Please tell me how to overcome this error.