Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

newcomer to the hibernate 4.1.2, but the first program doesn't work

 
li lianghong
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


It's my first time , I hava no idea .

Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2014)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1926)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1905)
at org.hibernate.test.StudentTest.main(StudentTest.java:21)
Caused by: org.dom4j.DocumentException: Error on line 17 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:482)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2006)
... 3 more
 
li lianghong
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And mapping file is: "Student.hbm.xml"

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="org.hibernate.model">
<class name="Student" table="student">
<id name="id" column="id" />
<property name="name" />
<property name="age" />
</class>
</hibernate-mapping>
 
li lianghong
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's my StudentTest.java

 
dhwani mathur
Ranch Hand
Posts: 621
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi li


Can you please change hibernate.cfg.xml the line




to




as in i think the double "<<" [opening brackets] in the tag is causing the issue.


I hope that helps.


 
li lianghong
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you! that's the problem .and it works!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic