Hibernate Tools - Unable to add config - dom4j Timedout connection -

Today I created a small project in my company. In Hibernate Perspective, I am trying to add a new config so that I can easily create objects from db tables that have multiple columns. But when I choose my project it gives meorg.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml

The complete stack trace is -

org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2246)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:2158)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:2137)
    at org.jboss.tools.hibernate.proxy.ConfigurationProxy.configure(ConfigurationProxy.java:100)
    at org.hibernate.console.ConfigurationFactory.loadConfigurationXML(ConfigurationFactory.java:355)
    at org.hibernate.console.ConfigurationFactory.configureStandardConfiguration(ConfigurationFactory.java:279)
    at org.hibernate.console.ConfigurationFactory.buildConfiguration(ConfigurationFactory.java:174)
    at org.hibernate.console.ConfigurationFactory.createConfiguration(ConfigurationFactory.java:96)
    at org.hibernate.eclipse.console.common.HibernateExtension$5.execute(HibernateExtension.java:166)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
    at org.hibernate.eclipse.console.common.HibernateExtension.execute(HibernateExtension.java:189)
    at org.hibernate.eclipse.console.common.HibernateExtension.buildWith(HibernateExtension.java:163)
    at org.hibernate.eclipse.console.common.HibernateExtension.build(HibernateExtension.java:134)
    at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:189)
    at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:43)
    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:98)
    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:104)
    at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:238)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect
    at org.dom4j.io.SAXReader.read(SAXReader.java:484)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2238)
    ... 18 more

      

Even after using many hibernate versions and changing the DTD many times, I can't figure out the problem. Can someone please help me on this. This is a simple maven project and the .cfg.xml file is placed in src / main / java

I even downloaded a simple project from this url http://www.mkyong.com/hibernate/maven-3-hibernate-3-6-oracle-11g-example-xml-mapping/ and then tried to add a new config but again got the same problem. I just changed the appropriate DB credentials that I had. They are correct as using the same jdbc url. I created a new DB connection in Data Source Explorer successfully. Please help.

The internet works great for my company.

+3


source to share


2 answers


Try changing the DTD definition in hibernate.cfg.xml

with

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

      

in



<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration SYSTEM
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

      

This way the XML parser will not try to load the DTD file from the internet, but it will try to load it from the Hibernate bins.

+1


source


You can open your config web browser (firefox) to check if your config file is ok. If it has something wrong, the browser will show you. I am referring to ( http://blog.csdn.net/caixiexin/article/details/7024623 ).



+1


source







All Articles