This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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">
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 ]