aspose file tools*
The moose likes Object Relational Mapping and the fly likes Mapping exception - cannot find Message.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 "Mapping exception - cannot find Message.hbm.xml" Watch "Mapping exception - cannot find Message.hbm.xml" New topic
Author

Mapping exception - cannot find Message.hbm.xml

Venkatraman Kandaswamy
Ranch Hand

Joined: Jul 07, 2004
Posts: 120
I am studying Hibernate in action and am stuck like a truck in a muck !!

My set up :

Tomcat 5.5.9
Mysql 4.1.12
Struts 1.2

I have a Message.java bean with 3 fields.
This is being mapped to the mysql table in Message.hbm.xml
There is an action class HibernateTest which tries to insert a record into the database.

All the above 3 class files are in the same directory.

Also I have hibernate.properties in WEB-INF/src/java which has the database details in it.

this is the code in HibernateTest.java


Now when I pull this on a browser it fails in the configuration line - where it tries to get the resource.

This is the exception that I get :
net.sf.hibernate.MappingException: Resource: net/kvrlogs/antiPC/actions/Message.hbm.xml not found

What do I do?

Thanks for your help.


--Venkatraman<br />SCJP 1.4<br /><a href="http://kvrlogs.blogspot.com" target="_blank" rel="nofollow">blog</a>
Venkatraman Kandaswamy
Ranch Hand

Joined: Jul 07, 2004
Posts: 120
stupid me. The message was loud and clear but not once did I check in WEB-INF/classes to see if message.hbm.xml was there. While building, my hbm.xml was not copied from WEB-INF/src to WEB-INF/classes. So I manually copied the file and that error went off. Then the next error I had was datasource not found. I had to then follow the instructions in the quickstart tutorial to get that working - some issue with JNDI and tomcat - there is a workaround suggested in this tutorial - clicky.

Now I am seeing this exception -


This comes when I am trying to start a transaction. Might be because I am using MySQL 4.1?? Had to do some more ing. Any suggestions on this??

The journey is the reward
Venkatraman Kandaswamy
Ranch Hand

Joined: Jul 07, 2004
Posts: 120
Well just to update - to help anyone looking at this post - I dropped tomcat and switched to jboss. It also had its share of oddities but finally got it working. Was able to successfully insert a record into the database. I will list the steps that I followed.

1. copy my-sql.ds.xml from JBOSS_HOME/doc/examples/JSA to $JBOSS_HOME/server/default/deploy
2. Edit my-sql.ds.xml to look like this

3. Edit JBOSS_HOME/server/default/conf/standardjaws.xml

4. Edit JBOSS_HOME/server/default/conf/standardjbosscmp-jdbc.xml

5. This is my hibernate.cfg.xml
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mapping exception - cannot find Message.hbm.xml