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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:58:40+00:00 2026-06-18T06:58:40+00:00

I m very new to hibernate , i have created a very basic example

  • 0

I m very new to hibernate , i have created a very basic example but as i try to run this application xml parsing error is coming . I have create a package for resource in which i have kept the Employee.hbm.xml and under the src folder in eclipse i have kept the hibernate.cfg.xml

This is my error

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Initial SessionFactory creation failed.org.hibernate.HibernateException: problem parsing configuration/com/nousinfo/resource
Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.nousinfo.tutorial.utils.HibernateUtil.buildSessionFactory(HibernateUtil.java:17)
    at com.nousinfo.tutorial.utils.HibernateUtil.<clinit>(HibernateUtil.java:7)
    at com.nousinfo.tutorial.dao.impl.EmployeeDAO.<clinit>(EmployeeDAO.java:15)
    at main.hibernatetest.main(hibernatetest.java:30)
Caused by: org.hibernate.HibernateException: problem parsing configuration/com/nousinfo/resource
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1222)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1161)
    at com.nousinfo.tutorial.utils.HibernateUtil.buildSessionFactory(HibernateUtil.java:12)
    ... 3 more
Caused by: org.dom4j.DocumentException: Error on line 1 of document  : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.
    at org.dom4j.io.SAXReader.read(SAXReader.java:350)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1217)
    ... 5 more

This is my hibernate.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping 
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" 
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">


<hibernate-configuration>
    <session-factory>
        <property name=hibernate.dialect ">
            org.hibernate.dialect.MySQLDialect
        </property-name>
            <property name=hibernate.connection.driver_class ">
                com.mysql.jdbc.Driver
            </property-name>
                <property name=hibernate.connection.url ">
                    jdbc:mysql://192.168.25.30:3306/employee
                </property-name>
                    <property name=hibernate.connection.username ">
                        jack
                    </property-name>
                        <property name=hibernate.connection.password ">
                            jack1234
                        </property-name>
                            <property name="show_sql">
                                true
                            </property>

                            <property name="connection.autocommit">
                                true
                            </property>
                            <!-- List of XML mapping files -->
                            <mapping resource="com/nousinfo/resource/Employee.hbm.xml" />
    </session-factory>
</hibernate-configuration>

This is my Employee.hbm.xml

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping 
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" 
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="Employee" table="EMPLOYEE">
        <meta attribute="class-description">
            This class contains the employee detail
        </meta>
        <id name="employeeNumber" type="int" column="EMPLOYE_NUMBER">
            <generator class="native" />
        </id>
        <property name="firstName" type="string" column="FIRST_NAME" />
        <property name="lastName" type="string" column="LAST_NAME" />
        <property name="title" type="string" column="TITLE" />
        <property name="departmentId" type="string" column="DEPARTMENT_ID" />
        <property name="address1" type="string" column="ADDRESS_1" />
        <property name="address2" type="string" column="ADDRESS_2" />
        <property name="city" type="string" column="CITY" />
        <property name="state" type="string" column="STATE" />
        <property name="pincode" type="int" column="PINCODE" />
        <property name="telephoneNumber" type="int" column="TELEPHONE_NUMBER" />
        <property name="mobileNumber" type="int" column="MOBILE_NUMBERr" />
        <property name="dateOfBirth" type="date" column="DATE_OF_BIRTH" />
        <property name="dateOfAnniversary" type="date" column="DATE_OF_ANNIVERSARY" />
        <property name="dateOfJoining" type="date" column="DATE_OF_JOINING" />
        <property name="dateOfLeaving" type="date" column="DATE_OF_LEAVING" />
        <property name="reasonForLeaving" type="string" column="REASON_FOR_LEAVING" />
    </class>

</hibernate-mapping>
  • 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-18T06:58:41+00:00Added an answer on June 18, 2026 at 6:58 am

    You are getting this exception as

    1. You haven’t put opening quotes (“) after name = in many lines in hibernate configuration file.
    2. You have ended a property tag with property-name tag in multiple lines of hibernate configuration file.
    3. Properties are not specified completely in hibernate configuration file.

    Besides these, you hibernate configuration file is full of syntax errors. Refer the following link on how to prepare hibernate configuration file.

    http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/session-configuration.html

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

Sidebar

Related Questions

Very new to python and can't understand why this isn't working. I have a
Very new to XSL (and XML for that matter), but I need to step
This may seem like a very simple question, but I have been struggling with
I have pasted Hibernate 3 configuration file , SessionFactory class to configure this config.xml
Im very new to Hibernate so this will probably a easy task for you
I am new to NHibernate and have just started right now. I have very
I just downloaded new release of Hibernate 4.0.1 final release. It is very strange
I am very new to Nhibernate. I would like to develop an application in
Very new to C++ and Cocos2d-x but I was just toying around with CCArray
Very new to FluentNHibernate, but I'm also excited about the area. I've recently started

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.