aspose file tools*
The moose likes Object Relational Mapping and the fly likes Could not parse mapping document from resource developerhelpway/hibernate/employee.hbm.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Could not parse mapping document from resource developerhelpway/hibernate/employee.hbm.xml" Watch "Could not parse mapping document from resource developerhelpway/hibernate/employee.hbm.xml" New topic
Author

Could not parse mapping document from resource developerhelpway/hibernate/employee.hbm.xml

sathish sathyamangalam
Greenhorn

Joined: Jan 04, 2012
Posts: 1
Hi

i am new to hibernate. i have did one small hibernate application for store employee name and salary in mysql database.

here i have mention the following files

1. configuration file
2. mapping file
3. main file
4. error message
5. pojo class

hibernate.cfg.xml

employee.hbm.xml

Emploree.java


main file

error message
Jan 4, 2012 1:02:28 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.1
Jan 4, 2012 1:02:28 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Jan 4, 2012 1:02:28 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
Jan 4, 2012 1:02:28 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Jan 4, 2012 1:02:28 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Jan 4, 2012 1:02:28 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Jan 4, 2012 1:02:28 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : developerhelpway/hibernate/employee.hbm.xml
org.hibernate.InvalidMappingException: Could not parse mapping document from resource developerhelpway/hibernate/employee.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:569)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1584)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1552)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1531)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1505)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1425)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1411)
at developerhelpway.hibernate.FirstExample.main(FirstExample.java:19)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:508)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:566)
... 7 more
Caused by: org.dom4j.DocumentException: http://hibernate.sourceforge.net/%0Ahibernate-mapping-3.0.dtd Nested exception: http://hibernate.sourceforge.net/%0Ahibernate-mapping-3.0.dtd
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:499)
... 8 more
Exception in thread "main" java.lang.NullPointerException
at developerhelpway.hibernate.FirstExample.main(FirstExample.java:33)

Please any one help me to find the issue.. Thanks in advance
Aditi Tervankar
Greenhorn

Joined: Apr 10, 2013
Posts: 8
Hi ,
Please use below in your DTD declaration , i had faced same issue and this resolved the same.

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

Please make sure no spaces present in this line "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


Thanks,
Aditi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Could not parse mapping document from resource developerhelpway/hibernate/employee.hbm.xml
 
Similar Threads
hbm file version working but annotation not
How to configure xxx.hbm.xml
Newbie got stuck in Hibernate "Hello World"
org.hibernate.MappingException: table refers to an unmapped class
Could not parse configuration: /hibernate.cfg.xml