hibernate 的 org.dom4j.DocumentException: Connection timed out 问题

时间:2014-06-05 08:52:44   收藏:0   阅读:371


hibbernate的异常的一种情况


一开始以为是数据库连接问题。。。。错了

Communication failure during handshake. Is there a server running on localhost:3306?这个才是数据库连接问题

---特别要注意版本对应,这种问就出现在下面了

问题定位:

org.dom4j.DocumentException: Connection timed out

Connection timed out: connect Nested exception: Connection timed out: connect

出现这个异常的原因之一是读取配置文件超时。


通常是在读取hibernate配置文件验证dtd时版本不对造成的。所以在生成hibernate配置文件的时候要注意配置文件的dtd版本。根据相应的hibernate.jar版本,生成对应的hbm.cfg.xml

如果出现以上异常 可以试下

<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

转换试下

<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

又或者是反过来!

hibernate 的 org.dom4j.DocumentException: Connection timed out 问题,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!