Hibernate throws org.dom4j.DocumentException: A route to the remote host is not available. (connect failed)

All, first my apologies If this has been previously discussed, but my search skills are turning up nothing useful at this time. I can code in the applications, but this is my first adventure in an Admin type roll for this application.

Issue: Running a Hibernate java application using the QP2SHELL command on the AS400 (v7r1). From the logs I am seeing (and my limited understanding) it appears the we are unable to connect to the AS400 DB. We were running just fine in out Production system, until mid-May, when it stopped working, but continues to work as expected in our Production environment on out development system. I am at a loss as our operations team has told us that both systems were at the same PTF levels.

We are using Hibernate v4.1.4

Log messages:

Caused by: org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2017)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1929)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1908)
at com.lear.app.gps.util.hibernate.HibernateUtil.buildSessionFactory(HibernateUtil.java:45)
… 11 more
Caused by: org.dom4j.DocumentException: A route to the remote host is not available. (connect failed) Nested exception: A route to
he remote host is not available. (connect failed)
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2009)
… 14 more

2018-08-13 08:10:42::: Starting Process!
2018-08-13 08:10:42 User ::: SHEFFERC
2018-08-13 08:10:42 fileName ::: /GPSVIEWER/GPSBSP_SHEFFERC.xlsx
08:10:44,437 [main] DEBUG HibernateUtil - jt400 driver location ::: rsrc:./
08:10:44,560 [main] DEBUG logging - Logging Provider: org.jboss.logging.Log4jLoggerProvider
08:10:44,991 [main] DEBUG HibernateUtil - Get Configuration from ::: /WWW/PHPPRD_GPS/gps/library/java/
08:10:44,993 [main] DEBUG HibernateUtil - Loading Configuration from ::: file:///www/phpprd_gps/gps/library/java/hibernate.cfg.xml
08:10:44,994 [main] DEBUG HibernateUtil - URL Debug ::: file:/www/phpprd_gps/gps/library/java/hibernate.cfg.xml, /www/phpprd_gps/g
/library/java/hibernate.cfg.xml, /www/phpprd_gps/gps/library/java/hibernate.cfg.xml
08:10:45,227 [main] ERROR HibernateUtil - Initial SessionFactory creation failed.[Ljava.lang.StackTraceElement;@56ac56ac

My config .xml

Any assistance would be great. We do have a work around, but I’d like the end users to return to running their own reports

Check out this StackOveflow answer and see if it helps.

Thanks Vlad. I see what they are doing, but not where it all fits in the configuration.xml.

Also, the configuration.xml that is used on the development system (production environment) is the same (difference is the system name in the “hibernate.connection.url”). It works just fine on the development system. If the final data file exists on the actual production system, I can change the config.xml to point to that system and it connects and runs just fine.

I cornered the original developer (he also did all of the configurations), he’s telling it looks like we’re failing to connect to the DB, not that we are not able to parse the config.xml.

Does anyone have any suggestions?

Most likely that the prod env has very strict networking rules and does not allow the JVM to access various address over the Internet.

Just embed the DTD in your app, and modify the Hibernate config files to use that instead as explained in this SO answer:

<!DOCTYPE hibernate-configuration SYSTEM