Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem parsing configuration / hibernate.cfg.xml

 
Divya Shastry
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys ...
I am new to Hibernate and in the learning process, i've got an exception. The stack trace is as follows :

problem parsing configuration/hibernate.cfg.xml
org.hibernate.HibernateException: problem parsing configuration/hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1291)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1230)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1216)
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:22)
Caused by: org.dom4j.DocumentException: Error on line 7 of document : The content of elements must consist of well-formed character data or markup. Nested exception: The content of elements must consist of well-formed character data or markup.
at org.dom4j.io.SAXReader.read(SAXReader.java:350)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1286)
... 3 more
Exception in thread "main" java.lang.NullPointerException
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:38)

The hibernate.cfg.xml is as follows :

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc racle:thin:@HOST:1521:TNS_NAME</property>
<property name="hibernate.connection.username">scott</property>
<property name="hibernate.connection.password">tiger</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="contact.hbm.xml"/>
</session-factory>
</hibernate-configuration>

Please suggest what is to be done next to overcome the problem

Thanks in advance !
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The content of elements must consist of well-formed character data or markup

Your config file is not well formed. Looking at the example you have posted it looks OK. Are you sure it is the one you are using? Check all elements are property closed and nested.
[ March 28, 2007: Message edited by: Paul Sturrock ]
 
Divya Shastry
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh ! I was using another file which had an extra <
Thanks a lot for guiding in that direction !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic