首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >hibernate.cfg.xml中的误差

hibernate.cfg.xml中的误差
EN

Stack Overflow用户
提问于 2011-01-19 17:55:08
回答 7查看 18.3K关注 0票数 3

在我的hibernate.cfg.xml中,我收到以下错误:

引用的文件包含错误(http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd)。有关更多信息,请右击问题视图中的消息并选择“显示详细信息.”

当我查看“显示详细信息”时,我会收到以下错误:

文档类型声明所包含或指向的标记声明必须是格式良好的。

这是我的hibernate.cfg.xml:

代码语言:javascript
运行
复制
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
    <property name="connection.url">jdbc:mysql://localhost/test</property>
    <property name="connection.username">root</property>
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="connection.password">root</property>
    <property name="hibernate.hbm2ddl.auto">update</property> 
 <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
    <!--  thread is the short name for
      org.hibernate.context.ThreadLocalSessionContext
      and let Hibernate bind the session automatically to the thread
    -->
    <property name="current_session_context_class">thread</property>
    <!-- this will show us all sql statements -->
    <property name="hibernate.show_sql">true</property>

    <mapping class="com.event.model.Event"/>

</session-factory>
</hibernate-configuration>
EN

回答 7

Stack Overflow用户

回答已采纳

发布于 2011-01-19 18:14:48

这很简单:http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd当前无法工作,因为jboss的服务器已经关闭。

票数 -1
EN

Stack Overflow用户

发布于 2014-04-15 09:45:32

指示的答案不是正确的答案!Jboss服务器肯定没有出现故障。

OPs问题中使用的URL是Hibernate文档站点上列出的内容,但是重定向到http://ww1.sourceforge.com,这是一个广告页面持有者- go图。

我在有效的DTD中找到的url位于:

http://www.jboss.org/dtd/hibernate/hibernate-configuration-3.0.dtd

希望这对解决这个问题的人有帮助。

票数 3
EN

Stack Overflow用户

发布于 2011-01-19 23:16:03

如果您愿意脱机工作,那么在xml目录中添加一个新的用户条目,将URI映射到DTD的本地副本。

代码语言:javascript
运行
复制
Window -> Preferences -> + XML -> XML Catalog.  

使用XML目录

XML目录教程

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4738817

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档