web开发错误

Caused by: org.hibernate.HibernateException: Could not parse configuration: file:/E:/workspace/ItcastOA/WebRoot/WEB-INF/classes/hibernate.cfg.xml 
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1528) 
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1477) 
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:601) 
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) 
    ... 48 more 
Caused by: org.dom4j.DocumentException: www.hibernate.org Nested exception: www.hibernate.org 
    at org.dom4j.io.SAXReader.read(SAXReader.java:484) 
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1518) 

    ... 53 more

由于hibernate的版本不同,xml文件头不同,导致的:

1,Hibernate 3.6.0 的XML的头:

    <!-- hibernate.cfg.xml文件 --> 
    <!DOCTYPE hibernate-configuration PUBLIC 
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

    <!-- hbm.xml文件 --> 
    <!DOCTYPE hibernate-mapping PUBLIC 
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 
        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

    <!-- hbm.xml文件中也可以使用这个 --> 
    <!doctype hibernate-mapping public 
        "-//hibernate/hibernate mapping dtd 3.0//en" 
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


2,Hibernate 3.3.1 的XML的头:

    <!-- hibernate.cfg.xml文件 --> 
    <!DOCTYPE hibernate-configuration PUBLIC 
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
    
    <!-- hbm.xml文件 --> 
    <!DOCTYPE hibernate-mapping PUBLIC 
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

转载: http://my.oschina.net/yangzhiyuan/blog/213902
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值