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

  • Home
  • SEARCH
  • 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 9127913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:23:41+00:00 2026-06-17T07:23:41+00:00

Hi am writing a simple hibernate program using anotation, below is my hibernate.cfg.xml file:

  • 0

Hi am writing a simple hibernate program using anotation, below is my hibernate.cfg.xml file:

 <!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory>

    <!-- Database connection settings -->
    <property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
    <property name="connection.url">jdbc:oracle:thin:@127.0.0.1:1521:XE</property>
    <property name="connection.username">vikas</property>
    <property name="connection.password">vikas</property>>

    <!-- JDBC connection pool (use the built-in) -->
    <property name="connection.pool_size">1</property>

    <!-- SQL dialect -->
    <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>

    <!-- Disable the second-level cache  -->
    <!-- <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property> -->

    <!-- Echo all executed SQL to stdout -->
    <property name="show_sql">true</property>

    <!-- Drop and re-create the database schema on startup -->
    <property name="hbm2ddl.auto">create</property>

    <!-- Name the annotated Entity -->
    <mapping class="org.vikas.hibernate.dto.UserDetails"></mapping>
</session-factory>

When i am trying to rum my program it throws following exception:

   16:41:07.592 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML:         
/hibernate.cfg.xml(56) The content of element type "session-factory" must match "(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)".
16:41:07.599 [main] ERROR org.hibernate.cfg.Configuration - problem parsing configuration/hibernate.cfg.xml
Exception in thread "main" org.hibernate.HibernateException: problem parsing configuration/hibernate.cfg.xml
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1222)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1161)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1147)
    at org.vikas.hibernate.dto.MainTest.main(MainTest.java:18)
Caused by: org.hibernate.MappingException: invalid configuration
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1218)
    ... 3 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 56; columnNumber: 23; The content of element type "session-factory" must match "(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1217)
    ... 3 more

Could you please tell me, where i am going wrong.

  • 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-17T07:23:42+00:00Added an answer on June 17, 2026 at 7:23 am

    The problem is one wrong character or missing character in your file.

    For example in the line

       <property name="connection.password">vikas</property>>
    

    you have an extra ‘>’ at the end. I don’t know if this is the error or if it happened when you removed the comments. If this is not the error then have a look for other wrong characters. This even might be an invisible character (but not a simple space, they are harmless). One time it happened to me the error was a missing line feed after the </hibernate-configuration> tag.

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

Sidebar

Related Questions

I'm writing some simple DAOs in Java using JDBC (no Spring, Hibernate or anything
I am writing simple parallel program in C++ using OpenMP. I am working on
I am writing simple client-server program. Client send some messages to server using UDP
I'm practising with C, writing simple programs. The little program below should just get
I am writing simple CRUD(Create, Remove ,Update ,Delete) application using Spring MVC and hibernate.
I'm writing simple program to communicate between smart devices and I receive 11001 when
I'm writing simple GUI using wxPyhon and faced some problems. My application does simple
As I'm a novice, I started learning python by writing simple programs using python
I am writing simple Linux module mod.c. When I compile mod.c file, it creates
I am writing simple program for my Ubuntu 10.04. I want to see which

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.