Could not parse configuration: hibernate.cfg.xml

Could not parse configuration: hibernate.cfg.xml

Hi,
I am getting the error-

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
    at com.javatpoint.mypackage.StoreData.main(StoreData.java:14)
Caused by: org.dom4j.DocumentException: C:\Users\kamlesh\workspace\empdetails\hibernate-configuration-3.0.dtd (The system cannot find the file specified) Nested exception: C:\Users\kamlesh\workspace\empdetails\hibernate-configuration-3.0.dtd (The system cannot find the file specified)
    at org.dom4j.io.SAXReader.read(SAXReader.java:484)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1532)
    ... 2 more

hibernate.cfg.xml file-


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration SYSTEM "hibernate-configuration-3.0.dtd" >
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="hbm2ddl.auto"></property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
<property name="connection.username">system</property>
<property name="connection.password">mansi2985</property>
<property name="dialect"> org.Hibernate.dialect.OracleDialect </property>

<mapping resource="employee.hbm.xml" />

</session-factory>
</hibernate-configuration>


StoreData.java-

package com.javatpoint.mypackage;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;


public class StoreData {

    public static void main(String[] args){
        //creating configuration object
        Configuration cfg=new Configuration();
        cfg.configure("hibernate.cfg.xml");    //populates the data of the configuration file

        //creating session factory object
        SessionFactory factory=cfg.buildSessionFactory();

        //creating session object
        Session session=factory.openSession();

        //creating session transaction
        Transaction t=session.beginTransaction();

        Employee e1=new Employee();
        e1.setId(115);
        e1.setFirstName("ritesh");
        e1.setLastName("kamlesh");

        session.persist(e1);    //persisting the object

        t.commit();                //transaction is committed

        session.close();

        System.out.println("sussessfully printed");

        }


}
View Answers

April 24, 2013 at 1:06 PM

hibernate.cfg.xml file-

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration SYSTEM "hibernate-configuration-3.0.dtd" >
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="hbm2ddl.auto"></property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
<property name="connection.username">system</property>
<property name="connection.password">-----</property>
<property name="dialect"> org.Hibernate.dialect.OracleDialect </property>

<mapping resource="employee.hbm.xml" />

</session-factory>
</hibernate-configuration>









Related Tutorials/Questions & Answers:
Could not parse configuration: hibernate.cfg.xml
Could not parse configuration: hibernate.cfg.xml  Hi, I am getting the error- log4j:WARN No appenders could be found for logger.... Exception in thread "main" org.hibernate.HibernateException: Could not parse
org.hibernate.InvalidMappingException: Could not parse mapping document - Hibernate
org.hibernate.InvalidMappingException: Could not parse mapping document .... Exception occur:Could not parse mapping document from resource event/Sample.hbm.xml org.hibernate.InvalidMappingException: Could not parse mapping
Advertisements
ModuleNotFoundError: No module named 'could'
ModuleNotFoundError: No module named 'could'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'could' How to remove the ModuleNotFoundError: No module named 'could'
ModuleNotFoundError: No module named 'could'
ModuleNotFoundError: No module named 'could'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'could' How to remove the ModuleNotFoundError: No module named 'could'
parse in iphone
parse in iphone  <p>{ itemCount: 2, subtotal: "$15.50", items:[ { title: "The Big Book of Foo", description: "Bestselling book of Foo by A.N. Other", imageUrl: "/images/books/12345.gif
could not start server. - EJB
could not start server.  Dear All I have installed netbeans 5.5.1 and sun java Application server 9.2 to run ejb program. But when I start... comes ---sun java server could not start. so what should I do to start this server
could someone help in this ........
could someone help in this ........  dear Sir/Mrs I'll be thankful for helping me on this ....... write a program that reads 10 numbers. find the largest number and count the occurrence of the largest number from a declared
parse xml
parse xml   <STATES> <STATE sname="AndhraPradesh" > <DISTRICT dname="Ananthapur" > <address> Apollo...; </STATE> How to parse the above xml. please help me   Here
php parse ini string
php parse ini string  Need to know how to parse the ini file to extract values
php parse string for url
php parse string for url  Do i need a regex to parse a URL-type string in PHP
parse url iphone sdk
parse url iphone sdk  How can i parse two different URL's using NSXMLParser
php parse string into array
php parse string into array  How can i parse a string into array and convert an array into string
php parse string to time
php parse string to time  I am looking for a solution to parse a string into a formatted date time string
parse map in java
parse map in java  What is a Parser? Can you give the source code to parse map in Java
could not connect to the server - JDBC
could not connect to the server  Hii sir, I am working with a JBDC program now. Now i am trying to host it. when i am trying to connect to the remote MySqL server, i got an exception like
Could not able to load jar file - WebSevices
Could not able to load jar file  Hi, I tried to parse the xml file to a java object. I followed the procedure that you have mentioned in the website. I created one batch file that consists of all
ModuleNotFoundError: No module named 'parse'
ModuleNotFoundError: No module named 'parse'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'parse' How to remove the ModuleNotFoundError: No module named 'parse'
ModuleNotFoundError: No module named 'parse-it'
ModuleNotFoundError: No module named 'parse-it'  Hi, My Python... 'parse-it' How to remove the ModuleNotFoundError: No module named 'parse... to install padas library. You can install parse-it python with following
ModuleNotFoundError: No module named 'parse_this'
ModuleNotFoundError: No module named 'parse_this'  Hi, My Python... 'parse_this' How to remove the ModuleNotFoundError: No module named 'parse_this' error? Thanks   Hi, In your python environment you
php parse ini array
php parse ini array  I wanted to parse a variable inside a variable value. Can any one give the example
php parse string as php
php parse string as php  Best way of parsing a string within a string
php parse ini file
php parse ini file  I need a simple and easy example to Parsing an ?advanced? INI file with PHP
php parse soap response
php parse soap response  What is soap and how can i convert a soap response to XML. Thanks in Advance
php parse string to float
php parse string to float  Is there any Regex or way to get float from a string
python date parse
python date parse  Hi, I want to parse the string date "20220131" into Python date. How to do that? Thanks
python date parse
python date parse  Hi, I want to parse the string date "20220131" into Python date. How to do that? Thanks
Could not open JPA EntityManager for transaction
Could not open JPA EntityManager for transaction  Hi, I am getting following error: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
php parse subdomain
php parse subdomain  Basically, looking for a example on how to let PHP to create subdomain automatically for each user? Is it possible to retrieve subdomain as a get variable
could any one help me?
could any one help me?  I'm a student in the faculty of computer and information science we will make graduation project "taxi dispatcher" we need to use mobile "x6 nokia" in car and send the coordinate of car through gps which
php parse string as int
php parse string as int  While trying to pass string to int using int() i get the following error: Call to undefined function int() Why it is throwing an error
php parse string to date
php parse string to date  In my app i have a date string in the following format: $date = "08/20/2009"; Can you suggest how can i separate each part of the date
Could someone Possibly help me with this
Could someone Possibly help me with this   think of a number and allow the user to guess it import java.util.*; public class ThinkNumber { public static void main (String args[]) { //generate number in range 1
SimpleDateFormat parse example
SimpleDateFormat parse example  Hi, How to parse a date in Java program with the help of SimpleDateFormat class? Tell me how to parse following variable: String dtStr = "10-Dec-2017"; into a date variable. Thanks   
Could not establish the connection to oracle - JDBC
Could not establish the connection to oracle  Hi Friends, I am working on JDBC.My program is to insert the data into student database. I am getting error like: java.sql.SQLEXception:IO exception:The Network Adapter could
could anyone please help with the code.
could anyone please help with the code.  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException...(request, response); } } could anyone please check the code. If i enter
could not find a getter for id in contact class
could not find a getter for id in contact class   could not find a getter for id in contact class
MySQL server PID file could not be found! [FAILED]
MySQL server PID file could not be found! [FAILED]  MySQL server PID file could not be found! [FAILED
Version of ca.fuzzlesoft>json-parse dependency
List of Version of ca.fuzzlesoft>json-parse dependency
Version of com.infstory>auto-parse dependency
List of Version of com.infstory>auto-parse dependency
Version of com.parse>parse-android dependency
List of Version of com.parse>parse-android dependency
JavaScript parse date
JavaScript parse date..., you will learn how to parse the date in JavaScript. JavaScript provides the function parse() that takes a date in string format and returns the equivalent
ModuleNotFoundError: No module named 'elasticsearch_parse'
ModuleNotFoundError: No module named 'elasticsearch_parse'  Hi, My... named 'elasticsearch_parse' How to remove the ModuleNotFoundError: No module named 'elasticsearch_parse' error? Thanks   Hi
ModuleNotFoundError: No module named 'iw-parse'
ModuleNotFoundError: No module named 'iw-parse'  Hi, My Python...-parse' How to remove the ModuleNotFoundError: No module named 'iw-parse... to install padas library. You can install iw-parse python with following
ModuleNotFoundError: No module named 'mobi-parse'
ModuleNotFoundError: No module named 'mobi-parse'  Hi, My Python... 'mobi-parse' How to remove the ModuleNotFoundError: No module named 'mobi-parse' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'mobi-parse'
ModuleNotFoundError: No module named 'mobi-parse'  Hi, My Python... 'mobi-parse' How to remove the ModuleNotFoundError: No module named 'mobi-parse' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'opengraph-parse'
ModuleNotFoundError: No module named 'opengraph-parse'  Hi, My... named 'opengraph-parse' How to remove the ModuleNotFoundError: No module named 'opengraph-parse' error? Thanks   Hi, In your python

Ads