報錯消息:java
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from file D:\應用安裝處\tomcat1\webapps\carDomain\WEB-INF\classes\cn\edu\gxuwz\entity\Box.hbm.xml at org.hibernate.cfg.Configuration.addFile(Configuration.java:325) at org.hibernate.cfg.Configuration.addDirectory(Configuration.java:668) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:713) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479) ... 25 more Caused by: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect at org.dom4j.io.SAXReader.read(SAXReader.java:484) at org.dom4j.io.SAXReader.read(SAXReader.java:264) at org.hibernate.cfg.Configuration.addFile(Configuration.java:311) ... 30 more
解決方案:web
將實體類對於的映射文件(xxx.hbm.xml)頭部信息修改,具體修改以下。spring
原來的: <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> 修改後的: <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">