2017-06-16 126 views
0

是异常的细节我:我得到异常“无法解析配置”下面

Exception in thread "main" org.hibernate.HibernateException: Could not        
     parse configuration:<br> 
     <br> hibernate.cfg.xml<br><br> 
     at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1491) 
     at org.hibernate.cfg.Configuration.configure(Configuration.java:1425) 
     at com.javatpoint.mypackage.StoreData.main(StoreData.java:14)<br> 
     Caused by: org.dom4j.DocumentException:Read timed out Nested exception: 
     Read timed out<br> <br> 
     at org.dom4j.io.SAXReader.read(SAXReader.java:484)<br> 
     at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481) 
     <br> 
     ... 2 more 

这是hibernate.hbm.xml我已经编码。我通过 XAMPP作为后端使用MySQL。能否请你帮忙解决这个问题 ? 'hr'是我正在使用的数据库名称。用户名为 root.password保留为空。

<!-- Generated by MyEclipse Hibernate Tools.     --> 
<hibernate-configuration> 
<session-factory> 
<property name="hbm2ddl.auto">update</property> 
<property name="dialect">org.hibernate.dialect.MySQLDialect</property> 
<propertyname="connection.url">jdbc:mysql://localhost:3306/hr</property> 
<property name="connection.username">root</property>  
<property name="connection.password"></property>  
<property 
name="connection.driver_class">com.mysql.jdbc.Driver</property> 
<mapping resource="employee.hbm.xml"/> 
</session-factory> 
</hibernate-configuration> 
+0

我加入DTD ......仍然得到了同样的错误 –

回答

1

。在你的hibernate.cfg.xml文件错字:一个空间标签名称property和属性名name之间失踪。改变这一行:

<propertyname="connection.url">jdbc:mysql://localhost:3306/hr</property> 

这样:

<property name="connection.url">jdbc:mysql://localhost:3306/hr</property> 
+0

感谢您的帮助。有效。 –