根组件类型为“hibernate-configuration”,但被声明为“hibernate-config”。你的xml文件里面这个地方写错了

解决方案 »

  1.   

    Caused by: org.xml.sax.SAXParseException: 根组件类型为“hibernate-configuration”,但被声明为“hibernate-config”。  是不是你把hibernate.cfg.xml文件里的<hibernate-configuration>写成了<hibernate-config
    >?你自己检查看看
      

  2.   

    我再把我的XML贴下,看得清楚些,感觉没啥错
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-config PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
        <session-factory>
             <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
             <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
             <property name="connection.url">jdbc:mysql://localhost:3306/hibernate</property>
             <property name="connection.username">root</property>
             <property name="connection.password"></property>       <mapping resource="hello/user.hbm.xml"/>
        </session-factory></hibernate-configuration>