-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: XML Document not well formed error
PostPosted: Tue Apr 19, 2011 8:26 pm 
Newbie

Joined: Tue Apr 19, 2011 7:26 pm
Posts: 4
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.


Top
 Profile  
 
 Post subject: Re: XML Document not well formed error
PostPosted: Tue Apr 19, 2011 8:32 pm 
Newbie

Joined: Tue Apr 19, 2011 7:26 pm
Posts: 4
Thanks, but I figured it out. It appears I had a double '<< ' on the '<hibernate-configuration> tag. Also, I left a quote off the front of one of the property name tags, and I forgot to end the </hibernate-configuration> tag.

Thanks anyway. Posting this just helped me to see the errors of my ways. :-)

Cheers.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.