• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate.MappingException

 
Karthik Vijayarajan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I get the exception net.sf.hibernate.MappingException Resource:com/verizon/rct/CD.hbm.xml not found. I am using Tomcat 5.0.28 and my database is MYSQL. I have the mapping document CD.hbm.xml under web-inf. After this exception, i tried to move the mapping document under my folder structure com/verizon/rct and it threw the following exception.

net.sf.hibernate.MappingException Error reading resource com/verizon/rct/CD.hbm.xml not found. Caused by net.sf.hibernate.MappingException Persistent Class CD not found.

Would be great if someone can help me get thru this !!!

Thanks
Karthik
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So where exactly have you put CD.hbm? It should be under WEB-INF/classes/com/verizon/rct/ so Tomcat's classloader can find it.
 
Karthik Vijayarajan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul
Thanks for the reply !!!
The CD.hbm.xml is placed under com/verizon/rct and my classpath also includes web-inf/classes/com/verizon/rct.

The configuration xml hibernate.cfg.xml is placed directly under web-inf.
->web-inf/hibernate-cfg.xml

The web-inf/classes/com/verizon/rct folder contains all the class files including CD.class.

It throws the following exception
net.sf.hibernate.MappingException:Error reading resource com/verizon/rct/CD.hbm.xml at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java)

Thanks
Karthik
 
Bhushan Garud
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am getting the following exception in eclipse at runtime.

net.sf.hibernate.MappingException: Error reading resource: CD.hbm.xml
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:358)
at CDTest.<init>(CDTest.java:45)
at CDTest.main(CDTest.java:228)

The xml file is in project classpath.

Would anyone please help me to solve this problem?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The partial error message you've posted suggests there may be a parsing issue. Can you post the whole error message?

(NB: why are you using such an old version of Hibernate?)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic