Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8025869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:18:28+00:00 2026-06-04T23:18:28+00:00

I am using Spring 3.0 and Hibernate 3.6 DataSource is defined as <bean id=test-pool

  • 0

I am using Spring 3.0 and Hibernate 3.6
DataSource is defined as

<bean id="test-pool"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
            <property name="url"
                value="jdbc:sqlserver://Machine:1433;databaseName=TEST;maxPoolSize=100;
                minPoolSize=5;acquireIncrement=5;checkoutTimeout=5000;maxStatements=100;idleConnectionTestPeriod=3000" />
            <property name="username" value="${user}" />
            <property name="password" value="${database.password}"/>

    </bean>

Session Factory with data source is

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource" ref="test-pool"/>
        <property name="configLocation" value="WEB-INF/classes/test.hibernate.cfg.xml"></property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
                <prop key="hibernate.cache.use_second_level_cache">true</prop>
            </props>
        </property>
    </bean>

In Factory class:

LocalSessionFactoryBean localfactorybean = (LocalSessionFactoryBean)AppContext.getBean("&sessionFactory");
        Configuration configuration = localfactorybean.getConfiguration();
        SessionFactory sessionFactory = configuration.buildSessionFactory();

But I am getting following exception

org.hibernate.HibernateException: No local DataSource found for configuration - 'dataSource' property must be set on LocalSessionFactoryBean
    at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.configure(LocalDataSourceConnectionProvider.java:49)
    at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:143)
    at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:84)
    at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:459)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:91)

What is wrong with my current code?

I get rid of this exception if I explicitly get SessionFactory again like this:

SessionFactory sessionFactory = (SessionFactory) AppContext.getBean("sessionFactory");

As you can see its not neat and I want to get rid of it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:18:29+00:00Added an answer on June 4, 2026 at 11:18 pm

    What exact version of Hibernate are you using? This article suggests that there is a problem with 3.2.1 which has the same symptoms as you have. Maybe time to update your version – hibernate is now at 4.1.4

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Spring with Hibernate as a JPA provider and are trying to get
I am using Spring with Hibernate in my project.There are many methods written in
We are developing a web application using Spring framework and Hibernate ORM. As far
I am working on an application using Spring 3 and Hibernate 3.5 with Java
I am using Spring 3, JPA + Hibernate for a CMS application. In that
I am developing project using Spring , Struts2 & Hibernate . Now I want
Implementing a simple Login screen using JSF and Spring and Hibernate. I have written
i am using spring 3 , JSF 2 , MYSQL , Hibernate , and
I'm doing a Web application using Spring 3.1.0.RELEASE, JSF 2.x, JPA 2 with Hibernate
I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.