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 6595141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:54:04+00:00 2026-05-25T17:54:04+00:00

I have a simple Java application and I’m trying to integrate Hibernate in Spring

  • 0

I have a simple Java application and I’m trying to integrate Hibernate in Spring but it seems that the Spring configuration file can’t find the *.hbm.xml (the mapping resource):
I have a file named persistence-context.xml that I use it as a Spring config file and I have the following bean declared:

org.hibernate.dialect.MySQLDialect

But is being thrown the exception:
java.io.FileNotFoundException: class path resource [pool.hbm.xml] cannot be opened because it does not exist
I’ve even tried giving the mapping resources property an absolute path value. It doesn’t work.
Thank you!

UPDATE:
My Spring conf file:

    <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value='jdbc:mysql://localhost/bestofs_seinfeld' />
        <property name="username" value="root" />
        <property name="password" value="futifuti825300" />
        <property name="initialSize" value="5" />
        <property name="maxActive" value="10" />
    </bean>

    <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="mappingResources" value="pool.hbm.xml" />
        <property name="hibernateProperties">
            <props>
                <prop key="dialect">org.hibernate.dialect.MySQLDialect</prop>
            </props>
        </property>
    </bean>

    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
        <property name="sessionFactory">
            <ref bean="mySessionFactory"/>
        </property>
    </bean>

    <bean id="voteDao" class="bestofs.persistence.HibernatePoolDao">
    <property name="hibernateTemplate">
        <ref bean="hibernateTemplate"/>    
    </property>
</bean>
</beans>

And my pool.hbm.xml is:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="bestofs.persistence.PoolBean" table="sein_pool">
    <id name="idVote" column="ID_Vote">
        <generator class="assigned"/>
    </id>

    <property name="IdActor">
        <column name="ID_Actor"/>
    </property>
    <property name="IdUser">
        <column name="ID_User"/>
    </property>
    <property name="IdSession">
        <column name="ID_Session"/>
    </property>
</class>
</hibernate-mapping>

And both configuration files are on the same folder.

  • 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-05-25T17:54:05+00:00Added an answer on May 25, 2026 at 5:54 pm

    If you are giving absolute path to the file location on disk (e.g. c:/mapings/pool.hbm.xml), it will not work, because it searches for mapping on a class path. Mapping file should be inside your jar or in IDE class path.

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

Sidebar

Related Questions

I have a simple java application that loads a properties file from the current
I have written a simple Java application that interacts with multiple instances of itself
I have written a very simple Java application. Can anyone tell me how to
I have a simple java applet that is invoked from gwt application. Is there
I have a very simple command line Java application that I wish to port
Say, I have a pretty simple Java application that needs the way to store
I'm writing a simple distributed java rmi application and I have a bunch of
I have a simple Java class that I need to serialize to be stored
I have a simple Java class that has some methods: public class Utils {
I have a very simple Java RMI Server that looks like the following: import

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.