Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
    Bookmark Topic Watch Topic
  • New Topic