Hi,
The problem we are running into is not directly a hibernate issue by itself. We have an J2EE application (comprising of .ear) which uses
Hibernate3. We have deployed our application on WebSphere and its working fine. The system where WebSphere is installed does not have any internet connectivity (blocked through firewalls). We are now porting the application onto NetWeaver. Even on this system, where NetWeaver is installed, there is no internet connectivity (again, blocked through firewall). The application runs into the following exceptions on NetWeaver while parsing the hibernate.cfg.xml:
Code:
org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1376)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
at com.tdemand.util.HibernateConfiguration.init(HibernateConfiguration.java:45)
at com.tdemand.init.TdAppInitServlet.init(TdAppInitServlet.java:65)
at com.sap.engine.services.servlets_jsp.server.runtime.context.WebComponents.addServlet(WebComponents.java:139)
at com.sap.engine.services.servlets_jsp.server.container.ApplicationThreadInitializer.loadServlets(ApplicationThreadInitializer.java:386)
at com.sap.engine.services.servlets_jsp.server.container.ApplicationThreadInitializer.run(ApplicationThreadInitializer.java:110)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: org.dom4j.DocumentException: Connection refused: connect Nested exception: Connection refused: connect
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1366)
... 11 more
Apparently, while parsing the hibernate.cfg.xml the SAXReader is trying to lookup the dtd on the internet since the hibernate.cfg.xml contains
Code:
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
And since the system does not have an internet connection, it throws up the errors. We came across this FAQ
http://www.hibernate.org/116.html#A35 on Hibernate site which mentions:
Quote:
this means that your XML parser does not support the EntityResolver callback that Hibernate uses to resolve the mapping DTD from inside hibernate3.jar. Either use a different XML parser, such as a recent version of Xerces, or edit your mapping documents to use a SYSTEM id instead of the PUBLIC id that we recommend in the documentation.
The xerces library that we are using is of version Xerces-J 2.6.2 and dom4j1.6. Are these versions of Xerces and dom4j recent enough to support the EntityResolver callback?
Also, since we are also using other frameworks like spring (which has its own set of xmls with dtds pointing to the internet) would upgrading to the recent version of Xerces/dom4j solve the issue?
And since we would be deploying this application in production, would replacing the xmls with a SYSTEM id be recommended or would upgrading to the recent version of xerces/dom4j a better option? Changing the xmls to point to SYSTEM id would involve changing hundreds of xmls in the application (including the autogenerated hbm.xml files).