3

今日、会社で小さなプロジェクトを作成しました。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 に配置されます

この URL http://www.mkyong.com/hibernate/maven-3-hibernate-3-6-oracle-11g-example-xml-mapping/から簡単なプロジェクトをダウンロードしてから、新しい構成を追加しようとしましたが、もう一度同じ問題が発生しました。持っていたそれぞれの DB 資格情報を変更しました。同じjdbc urlを使用してData Source Explorerで新しいDB接続を正常に作成したため、それらは正しいです。親切に助けてください。

私の会社では、インターネットは正常に機能しています。

4

2 に答える 2

2

以下の DTD 定義を変更してみてくださいhibernate.cfg.xml

<?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">

に:

<?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">

この方法では、XML パーサーは DTD ファイルをインターネットからロードしようとはしませんが、Hibernate jar からロードしようとします。

于 2015-07-01T05:59:53.700 に答える