What can I do with “Could not parse configuration” error from Hibernate?


I am following <a href="http://www.youtube.com/watch?v=GINvxAaXDbY&feature=related" rel="nofollow">Java Hibernate tutorial</a> example from YouTube. Everything looks great until I try to run code which is supposed to create table Employee on Apache Derby server. I tried to use SQL server (2008) first and I was getting the same error. <strong>Could not parse configuration: hibernate.cfg.xml</strong> and there is also <strong>timeout error</strong>. I appreciate any help. Thanks.

<strong>Here is the error I get:</strong>

17:28:51,574 INFO Version:15 - Hibernate Annotations 3.4.0.GA 17:28:51,587 INFO Environment:560 - Hibernate 3.3.2.GA 17:28:51,590 INFO Environment:593 - hibernate.properties not found 17:28:51,594 INFO Environment:771 - Bytecode provider name : javassist 17:28:51,597 INFO Environment:652 - using JDK 1.4 java.sql.Timestamp handling 17:28:51,648 INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA 17:28:51,655 INFO Configuration:1474 - configuring from resource: hibernate.cfg.xml 17:28:51,655 INFO Configuration:1451 - Configuration resource: hibernate.cfg.xml 17:28:51,702 DEBUG DTDEntityResolver:64 - trying to resolve system-id [http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd] 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.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1035) at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:64) at org.hibernate.cfg.Configuration.configure(Configuration.java:1476) at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1017) at com.hibernate.chapter1.TestEmployee.main(TestEmployee.java:14) 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:1532) ... 5 more

<strong>Here is my hibernate.cfg.xml file:</strong>

<?xml version='1.0' encoding='utf-8'?> <!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">org.apache.derby.jdbc.ClientDriver</property> <property name="connection.url">jdbc:derby://localhost:1527/HibernateDb;create=true</property> <property name="connection.username">user</property> <property name="connection.password">password</property> <!-- JDBC connection pool (use the built-in) --> <property name="connection.pool_size">2</property> <!-- SQL dialect --> <property name="dialect">org.hibernate.dialect.DerbyDialect</property> <!-- Enable Hibernate's current session context --> <property name="current_session_context_class">thread</property> <!-- Disable the second-level cache --> <property name="cache.provider_class">org.hibernate.cache.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> </session-factory> </hibernate-configuration>

<strong>And, here is the code I am running:</strong>

package com.hibernate.chapter1; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.tool.hbm2ddl.SchemaExport; public class TestEmployee { public static void main(String[] args) { AnnotationConfiguration config = new AnnotationConfiguration(); config.addAnnotatedClass(Employee.class); config.configure("hibernate.cfg.xml"); new SchemaExport(config).create(true, true); } }

What did I do wrong?


This means the hibernate.dtd cannot be resolved - its resolution is attempted on the server. The dtd is contained in the jars files - see <a href="https://forum.hibernate.org/viewtopic.php?f=1&t=949031" rel="nofollow">here</a> and <a href="http://forum.springsource.org/showthread.php?80886-How-to-configure-hibernate.cfg.xml-to-work-offline" rel="nofollow">here</a> for how to resolve it.


  • Login form issue with spring security 2.0.7 and spring 2.5
  • Dynamic Event Handler not Firing
  • a:first-child modifying all links within my list
  • Hibernate - Cannot connect to DB
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • Unable to connect to OnVif enabled camera using C#
  • .NET video play library which allows to change the playback rate?
  • Is it possible to run clang with llc flags
  • VSCode change debug shell to bash on windows
  • Getting different value with placeholder over CPU/GPU
  • How to use jQuery's $.post() method with async/await and typescript
  • Overlapping controls in Windows XP
  • Visual Studio 2010 debugger build correctly - compiler pdb and linker pdb not in synch?
  • Very simple C++ DLL that can be called from .net
  • Setting up SourceTree to merge unity3d scenes with UnityYAMLMerge
  • Unity3D & Android: Difference between “UnityMain” and “main” threads?
  • Read a local file using javascript
  • Can I check if a recipient has an automatic reply before I send an email?
  • ImageMagick, replace semi-transparent white with opaque white
  • does jqgrid support a multiple checkbox list for editing
  • Cannot connect to cassandra from Spark
  • Getting last autonumber in access
  • Optimizing database types to compact database (SQLite)
  • Cross-Platform Protobuf Serialization
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • Do I've to free mysql result after storing it?
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • How to delete a row from a dynamic generate table using jquery?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • json Serialization in asp
  • Proper folder structure for lots of source files
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How to stop GridView from loading again when I press back button?
  • Turn off referential integrity in Derby? is it possible?
  • How does Linux kernel interrupt the application?
  • JaxB to read class hierarchy