Hi! We are experiencing an issue when running hbm2java this morning. Nothing changed, the error is saying it cannot read the doctype. Is there something wrong with the .dtd file temporarily? We can reach the file so it’s there…
Caused by: org.dom4j.DocumentException: Error on line 1 of document http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd : The markup declarations contained or pointed to by the document type declaration must be well-formed. Nested exception: The markup declarations contained or pointed to by the document type declaration must be well-formed.
at org.dom4j.io.SAXReader.read (SAXReader.java:482)
at org.hibernate.cfg.Configuration.doConfigure (Configuration.java:1518)
at org.hibernate.cfg.Configuration.configure (Configuration.java:1477)
Look like something similar brought us down as well. The DTD that is was published on Febuary 22nd looks to be causing
Caused by: org.hibernate.boot.InvalidMappingException: Could not parse mapping document: null (INPUT_STREAM)
at org.hibernate.boot.jaxb.internal.InputStreamXmlSource.doBind(InputStreamXmlSource.java:46) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
at org.hibernate.boot.jaxb.internal.InputStreamXmlSource.doBind(InputStreamXmlSource.java:38) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
at org.hibernate.boot.spi.XmlMappingBinderAccess.bind(XmlMappingBinderAccess.java:94) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
at org.hibernate.boot.MetadataSources.addInputStream(MetadataSources.java:382) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:475) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:515) ~[spring-orm-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at com.connexin.op.application.DataSourceConfig.medicalSessionFactory(DataSourceConfig.java:106) ~[classes/:?]
We have the same problem as hibscott.
I have changed the URL as indicated by hibscott in the temporary fix but it doesn’t work.
The error is as follows:
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,3]
Message: The marker declarations that are included or pointed to by the document type declaration must be in the correct format.
... 19 more
Thank you very much, yrodiere, this worked like a charm.
So the http:// support has been discontinued?
Ok, we will have to deploy new versions of the application to change the protocol.
I’m worried that the online DTD will suffer some problem in the future like a DTD domain crash due to DDos attack or an unauthorized access that replaces the original with a fake DTD, many applications in the world would fall like a house of cards.
I would also recommend some kind of advance warning when such changes are going to be made so as not to cause panic.
It has not. IT seems to have added an automatic redirection from HTTP to HTTPS, that’s all. And they did it without warning the Hibernate team
Fake DTDs are less of a problem if you use HTTPS, but network failures are for sure. Which is why it’s better to host a copy of the DTD locally. Or to disable DTD validation on production environmnents, but I’m not sure how to do that.
To answer with our current usecase:
with this URL it fails <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
with this one it works <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
OS: Windows 11, Google cloud, On Prem… (Not related to OS)
JDK: OpenJDK8, Amazon Corretto 11
SpringBoot, old application… (Not related)
Hibernate-Version: 3.1.3 (at least)
Sample of hmb.xml
2022-02-24 16:21:17.267 ERROR xxxxxx:61 - Error parsing XML: XML InputStream(1) The markup declarations contained or pointed to by the document type declaration must be well-formed.
2022-02-24 16:21:17.272 ERROR xxxxxxx:52 - server error org.hibernate.MappingException: Could not read mappings from resource: xxxxxx.hbm.xml
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
And I also have updated the config file with: <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "https://hibernate.org/dtd/hibernate-configuration-3.0.dtd" >
But I getting the error
2022-02-24 17:01:59.990 INFO XXXXXX:497 - Reading mappings from resource: com/zdirect/core/XXXXX.hbm.xml
2022-02-24 17:02:01.222 ERROR XXXXXX:52 - server error org.hibernate.MappingException: Could not read mappings from resource: XXXXX.hbm.xml
Ok but in my case I would like to not change anything in my code as it will imply a lot of re-deployment in production.
If we can make the http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd work as before it will save a lot of time.
If not then we will patch