• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

i am getting error in hibernate

 
Ramamohan Gadilli
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am new to hibernate,

i am getting error in hbm.xml file

like
SEVERE: Error parsing XML: XML InputStream(3) The processing instruction target matching "[xX][mM][lL]" is not allowed.
org.hibernate.MappingException: Could not read mappings from resource: CD.hbm.xml
at org.hibernate.cfg.Configuration.addClass(Configuration.java:506)
at CDTest.<init>(CDTest.java:31)
at CDTest.main(CDTest.java:204)
Caused by: org.hibernate.MappingException: Could not parse mapping document in input stream
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:431)
at org.hibernate.cfg.Configuration.addClass(Configuration.java:503)
... 2 more
Caused by: org.dom4j.DocumentException: Error on line 3 of document : The processing instruction target matching "[xX][mM][lL]"
s not allowed. Nested exception: The processing instruction target matching "[xX][mM][lL]" is not allowed.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:422)
... 3 more
java.lang.NullPointerException

any one please can you help me
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CD.hbm.xml appears to be invalid XML. Check that. If you can't see what is making it invalid, you can post it here and someone may point out your mistake.
 
Suyash Soni
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CD.hbm.xml is as follows please tell me the mistake that i've done.

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

<hibernate-mapping>
<class name="hibernate6.CD" table="cd">
<id name="id" type="integer">
<generator class="hilo"/>
</id>

<discriminator column="cd-type" type="string"/>

<property name="title"/>
<property name="artist"/>
<property name="purchaseDate" type="date"/>
<property name="cost" type="double"/>

<subclass name="hibernate6.SpecialEditionCD">
<property name="newfeatures" type="string"/>
</subclass>

<subclass name="InternationalCD">
<property name="languages"/>
<property name="region" type="int"/>
</subclass>
</class>
</hibernate-mapping>
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic