我今天在我的公司创建了一个小项目。在 Hibernate Perspective 中,我尝试添加新配置,以便可以从具有多个列的 db 表轻松创建实体。但是当我选择我的项目时,它给了我org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
完整的堆栈跟踪 -
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
即使在使用了许多休眠版本并多次更改 DTD 之后,我也无法找出问题所在。有人可以帮我解决这个问题。这是一个简单的 maven 项目,.cfg.xml 文件放在 src/main/java
我什至从这个网址http://www.mkyong.com/hibernate/maven-3-hibernate-3-6-oracle-11g-example-xml-mapping/下载了一个简单的项目,然后尝试添加新配置,但又一次有同样的问题。我刚刚更改了我拥有的相应数据库凭据。它们是正确的,因为使用相同的 jdbc url 我已经在数据源资源管理器中成功创建了一个新的数据库连接。请帮忙。
我公司的互联网运行良好。