Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"Could not read mapping document from file:"

 
jeff wisgo
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have hibernate working perfectly on my development server, but when I zip up all the files (including tomcat, java, all JSP, class files, and JAR files) and reproduce this tree on another system with the same newly-installed OS (Redhat Enterprise), Hibernate is failing immediately with the following exception:


System Error: org.hibernate.MappingException: Could not read mapping document from file: /enerlook/jakarta-tomcat/webapps/roverlook/WEB-INF/classes/roverlook/Media.hbm.xml at org.hibernate.cfg.Configuration.addFile(Configuration.java:269) at org.hibernate.cfg.Configuration.addDirectory(Configuration.java:582) at roverlook.HibernateSessionFactory.initialization(HibernateSessionFactory.java:89) at roverlook.HibernateSessionFactory.getCurrentSession(HibernateSessionFactory.java:33) at roverlook.VideoSessionManager.(VideoSessionManager.java:28) at roverlook.RoverlookInterface.(RoverlookInterface.java:50) at roverlook.ServiceManager.(ServiceManager.java:53) at roverlook.ControllerData.initializeData(ControllerData.java:41) at roverlook.StaticPageController.processRequest(StaticPageController.java:38) at roverlook.BasicController.doGet(BasicController.java:44) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at


The 'Media.hbm.xml' file is there with the same permissions, checksum, and size as the one on the existing server. There must be some difference between the systems causing this, but I can't fathom what it is. Any ideas?
 
Sebastian Hennebrueder
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just an idea, did you verify that it is not a class issue. This is quite common especially with JBoss application server.
Which Server, Java, Hibernate Version do you use?

Best Regards
Sebastian
 
jeff wisgo
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found my problem, but I haven't solved it completely. The problem was that the DTD in my .hbm.xml file was pointing to an external source, but I didnt have my name server configured. Unfortunately, I would like this server to work without needing external internet access, so I have tried to compy the .dtd file to my local file system in the same directory as my .hbm.xml files and changed the path to "./(filename)", but it still is unable to find the file.

As a follup question, does anyone know where my default directory would be in this case?

Old XML header:


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


New XML header:


<!DOCTYPE hibernate-mapping SYSTEM
"./hibernate-mapping-2.0.dtd" >



Thanks in advance!
 
Bridget Kennedy
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just tackled this same issue. I put the dtd in the current working directory and referenced it in the hbm.xml files as so:



Note that I am using Hibernate 3.0. Your file will be the 2.0 dtd - unless you have upgraded to Hibernate 3.0, in which case you have another problem: mismatched Hibernate version and dtd. :roll:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic