Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Hibernate Could not parse configuration: hibernate.cfg.xml

Have Programming Question? Ask it here!
 
 
 


kamlesh prajapati
Could not parse configuration: hibernate.cfg.xml
1 Answer(s)      a year and 4 months ago
Posted in : Hibernate


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");

        }


}

Advertisement
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
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
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 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
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
parse map in java
parse map in java  What is a Parser? Can you give the source code to parse map in Java
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 string to float
php parse string to float  Is there any Regex or way to get float from 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 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
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
date_parse
date_parse() in PHP date_parse function returns associative array... error. Description on Date Parse Format in PHP array date_parse ( string $date ) Parameters of date parse class PHP date - Date in format accepted
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
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
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
how to parse xml in j2me tutorial
how to parse xml in j2me tutorial   i want to parse xml file in j2me wireless toolkit.i saw ur examples & source code for parsing xml file in j2me & i try to execute same example on my pc i some how manage to run
date_parse_from_format
  date_parse_from_format date_parse_from_format function returns... about given date. Description on PHP Date Parse Format array date_parse_from_format ( string $format , string $date ) Parameters of Date Parse Function PHP
parse a file into primitive binary format
parse a file into primitive binary format  Hi, I need help converting an audio file or any other file to its primitive binarty format, and when I read the inputstream I find it some integers and I don't know its binary
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
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
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
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
how to parse a csv file using standard libraries?
how to parse a csv file using standard libraries?  hie i am a beginner in java i want to parse a csv file using any standard libraries i want to know how the libraries are imported and used in eclipse thanks in advance
How to parse an HTML link and display whole content, in iPhone?
How to parse an HTML link and display whole content, in iPhone?  I want to display whole content of any HTML link in a textview. I searched so many links , i could only get page titles or some part of the HTML page. But I could
Mysql Date Parse
Mysql Date Parse       Mysql Date is used to parse the string date time in Date Format function... illustrate an example from 'Mysql Date Parse'. To understand and grasp example we use
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
how do you parse by reference in java(with JGrasp)
how do you parse by reference in java(with JGrasp)  i am a 1st year beginner in java programming(GR 10) at hillcrest High School in south Africa My question is how do you parse by reference in java(with JGrasp) please help me i
socket connection: how to parse data from server?
socket connection: how to parse data from server?  hi, I am a j2me programmer,i want to retrieve some data from server using socket connection,I h'v... with inputstream read() method. Now I want to know, how to parse the data from
Java code to parse xml - Java Beginners
Java code to parse xml   TL1 10.50.26.98... to parse the code and get the values from.../GetData.shtml The example explains how to parse a xml document. Thanks
NoClassDefFoundError: Could not initialize class com.net.plugin.HibernatePlugIn - Struts
NoClassDefFoundError: Could not initialize class com.net.plugin.HibernatePlugIn  Could not initialize class com.net.plugin.HibernatePlugIn... But its giving error such like NoClassDefFoundError: Could not initialize class
Use of <x:parse> tag of JSTL
:parse> tag of  Xml tag library of Jstl. This tag is used to parse... at hand. parse_xmlJstlTag.jsp <%@ taglib prefix="c" uri...;head> <title>Example of x:parse tag</title> </head> <
How could I use Socket in my application?
How could I use Socket in my application?  I created an application dealing with the management of a supermarket using Hibernate and Swing. I found out today that I have to use also Socket and I don't know exactly what I could do
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded  Hi... com.mysql.jdbc.Driver could not be loaded Exception in thread "main... com.mysql.jdbc.Driver could not be loaded
org.hibernate.MappingException: Could not read mappings from resource:
org.hibernate.MappingException: Could not read mappings from resource: ...: hibernate.cfg.xml...: org.hibernate.MappingException: Could not read mappings from resource: hbmxml/login.hbm.xml please
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded  Hi... com.mysql.jdbc.Driver could not be loaded Exception in thread "main... com.mysql.jdbc.Driver could not be loaded
Advertisements
 

 

 

DMCA.com