Hello,
I'm getting an error with the hibernate.cfg.xml file. Here is the stacktrace:
Code:
20:20:05,936 INFO Version:15 - Hibernate Annotations 3.4.0.GA
20:20:05,958 INFO Environment:500 - Hibernate 3.2.0.cr5
20:20:05,964 INFO Environment:533 - hibernate.properties not found
20:20:05,968 INFO Environment:667 - Bytecode provider name : cglib
20:20:05,974 INFO Environment:584 - using JDK 1.4 java.sql.Timestamp handling
20:20:06,151 INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA
20:20:06,166 INFO Configuration:1350 - configuring from resource: hibernate.cfg.xml
20:20:06,167 INFO Configuration:1327 - Configuration resource: hibernate.cfg.xml
20:20:06,256 DEBUG DTDEntityResolver:38 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
20:20:06,257 DEBUG DTDEntityResolver:40 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
20:20:06,259 DEBUG DTDEntityResolver:50 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
20:20:06,293 ERROR XMLHelper:61 - Error parsing XML: hibernate.cfg.xml(6) The markup in the document preceding the root element must be well-formed.
Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1418)
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:1352)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1017)
at com.hibernate.chapter1.TestEmployee.main(TestEmployee.java:14)
Caused by: org.dom4j.DocumentException: Error on line 6 of document : The markup in the document preceding the root element must be well-formed. Nested exception: The markup in the document preceding the root element must be well-formed.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1408)
... 5 more
Here is the hibernate.cfg.xml file:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/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="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>
<!-- Diable 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>
</session-factory>
Thank you in advance for your help.