Hibernate在断网的情况下解析错误,请大家帮忙看看
在连网的情况下项目工作正常,但是在断网的情况下项目工作出错,总是报Person.hbm.xml解析错误:org.hibernate.InvalidMappingException: Could not parse mapping document from resource Person.hbm.xmlPerson.hbm.xml代码如下:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.zh.hibernate.model.Person" table="person">
<id name="id" column="id" type="int">
<generator class="increment"/>
</id>
<property name="username" type="string" column="username"/>
<property name="password" type="string" column="password"/>
<property name="age" type="int" column="age"/>
<property name="registerDate" type="date" column="registerDate"/>
</class>
</hibernate-mapping>
--------------------编程问答-------------------- 默认验证居然是true。。。参考
http://stackoverflow.com/questions/4301294/cant-parse-hibernate-cfg-xml-while-offline
和
https://forum.hibernate.org/viewtopic.php?f=1&t=943281&start=0
--------------------编程问答-------------------- http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd这个换成本地路径就可以了 --------------------编程问答-------------------- 我前段时间也遇到类似问题,可能原因是解析hiberante配置文件和mapping文件时需要从网上下载*.dtd,后来就预先把*.dtd下载下来了,http://blog.csdn.net/snarlfuture/article/details/17309279
补充:Java , Web 开发