在我的hibernate.cfg.xml中,我收到以下错误:
引用的文件包含错误(http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd)。有关更多信息,请右击问题视图中的消息并选择“显示详细信息.”
当我查看“显示详细信息”时,我会收到以下错误:
文档类型声明所包含或指向的标记声明必须是格式良好的。
这是我的hibernate.cfg.xml:
<?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>发布于 2011-01-19 18:14:48
这很简单:http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd当前无法工作,因为jboss的服务器已经关闭。
发布于 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
希望这对解决这个问题的人有帮助。
发布于 2011-01-19 23:16:03
如果您愿意脱机工作,那么在xml目录中添加一个新的用户条目,将URI映射到DTD的本地副本。
Window -> Preferences -> + XML -> XML Catalog. 使用XML目录
XML目录教程
https://stackoverflow.com/questions/4738817
复制相似问题