Hi, I´m trying to make an EJB (session) use Hibernate to list some entities from a database, but DTD validation is really annoying. I´m using Jboss 3.2.3, and I´m deploying the EJB Module as a jar file.
I tried 3 things and had a different error in each case. xml #1: ========= hibernate.cfg.xml ============= <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration.dtd"> <hibernate-configuration> <session-factory> (...) ========================================== Failure #1: ========================================== org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net at org.dom4j.io.SAXReader.read(SAXReader.java:358) (...) Nested exception: java.net.UnknownHostException: hibernate.sourceforge.net ========================================== So I thought that Depending on finding hibernate.sourceforge.net to make my application run would be the last thing I wanted, so i tried xml#2 ========= hibernate.cfg.xml ============= <hibernate-configuration> <session-factory> (...) ========================================== Failure #2: ========================================== net.sf.hibernate.MappingException: invalid configuration Caused by: org.xml.sax.SAXParseException: Document root element "hibernate-configuration", must match DOCTYPE root "null". ========================================== So I downloaded the DTD, placed on the jar file at the same level of hibernate.cfg.xml and tried xml #3 ========= hibernate.cfg.xml ============= <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "hibernate-configuration.dtd"> <hibernate-configuration> <session-factory> (...) ========================================== Failure #3: ========================================== org.dom4j.DocumentException: E:\jboss-3.2.3\bin\hibernate-configuration.dtd Nested exception: E:\jboss-3.2.3\bin\hibernate-configuration.dtd Nested exception: java.io.FileNotFoundException: E:\jboss-3.2.3\bin\hibernate-configuration.dtd ========================================== And I *really* wouldn´t like to have to place a dtd file in E:\jboss-3.2.3\bin. What can I do to make DOM ignore DTD consistency check when parsing hibernate.cfg.xml? Tanx in advance Tony Lumpda
hibernate.cfg.renametoxml
Description: Binary data