aspose file tools*
The moose likes Object Relational Mapping and the fly likes Could not parse configuration: /hibernate.cfg.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Could not parse configuration: /hibernate.cfg.xml" Watch "Could not parse configuration: /hibernate.cfg.xml" New topic
Author

Could not parse configuration: /hibernate.cfg.xml

Ankit Jindal
Greenhorn

Joined: Aug 20, 2010
Posts: 2

Hi Guys,

I am very new to Hibernate and trying to run very simple program of hibernate.
But I am getting following error (Could not parse configuration:/hibernate.cfg.xml
) error. It seems there is some problem with hibernate.cfg.xml.


Initial SessionFactory creation failed kuch .org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.vaannila.util.HibernateUtil.<clinit>(HibernateUtil.java:13)
at com.vaannila.course.Main.saveCourse(Main.java:22)
at com.vaannila.course.Main.main(Main.java:12)
Caused by: org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1364)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1298)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1284)
at com.vaannila.util.HibernateUtil.<clinit>(HibernateUtil.java:10)
... 2 more
Caused by: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1354)
... 5 more

Here is my hibernate.cfg.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3//EN" "http://hibernate.sourceforge.net/ hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernateTest</property>
<property name="hibernate.connection.username">root</property>
<property name="show_sql">true</property>
<property name="connection.password">.</property>
<property name="connection.pool_size">10</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<mapping resource="com/vaannila/course/Course.hbm.xml" />
</session-factory>
</hibernate-configuration>
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 513

Check you DTD in the second line.
there is a space in this - "http://hibernate.sourceforge.net/ hibernate-configuration-3.0.dtd".Remove the white space.
Always once you have completed the xml file try opening it in IE. You might catch some errors like this.


If you are not laughing at yourself, then you just didn't get the joke.
Ankit Jindal
Greenhorn

Joined: Aug 20, 2010
Posts: 2
Thanks Arun...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Could not parse configuration: /hibernate.cfg.xml