-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Error with DTD declaration
PostPosted: Tue Jun 18, 2013 10:48 am 
Newbie

Joined: Tue Jun 18, 2013 10:32 am
Posts: 1
I just migrated us from version 3 to version 4.2.2 of Hibernate. After the migration I am getting the error "SAXParseException ... Element type hibernate-mapping must be declared." I checked my (Tomcat) WEB-INF/lib directory and Hibernate's version 4 core .jar file is there, so it's on the classpath. Before this migration, I experienced no such errors. The only change during the migration was deleting the old Hibernate .jar files and moving the "required" jars from the new Hibernate version to my project, as well as changing the DTD declaration in the .hbm.xml files.

I am aware that the Hibernate team migrated from the doctype

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

to

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

I changed my .hbm.xml files to the new DTD declaration but it does not fix the Exception described above. I looked in the hibernate core jar file and the following file is there: org/hibernate/hibernate-mapping-3.0.dtd. My project programmatically configures Hibernate through the Configuration object. In a test project using a configuration file (.cfg.xml), I conducted the same migration (from v3 to v.4.2.2) and the migration works without getting any Exceptions. (I'm not saying that the Exception is due to using programmatic configuration, but that is one possibility).

Here is the Exception:
Code:
Caused by: org.xml.sax.SAXParseException; systemId: ; lineNumber: 6; columnNumber: 20; Element type "hibernate-mapping" must be declared.
            at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
            at org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1807)
            at org.apache.xerces.validators.common.XMLValidator.validateElementAndAttributes(XMLValidator.java:3633)
            at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1229)
            at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:938)
            at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
            at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)


Lastly, this is a crosspost from stackoverflow.com which I apologize for. The question has been up there for quite a while with no response, but I think this is a much better forum for the question.


Top
 Profile  
 
 Post subject: Re: Error with DTD declaration
PostPosted: Thu Aug 15, 2013 3:52 pm 
Newbie

Joined: Thu Aug 15, 2013 3:48 pm
Posts: 1
Were you able to fox this problem? If so, can you advise me how to fix it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.