当前位置: 代码迷 >> Java Web开发 >> Hibernate 报错Could not parse 地图ping document from resource
  详细解决方案

Hibernate 报错Could not parse 地图ping document from resource

热度:557   发布时间:2016-04-12 22:44:05.0
Hibernate 报错Could not parse mapping document from resource
hibernate.cfg.xml

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD//EN"
  "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>

        <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@localhost:1521:oracle</property>
        <property name="connection.username"></property>
        <property name="connection.password"></property>

<mapping resource="hibernate/po/Login.hbm.xml"/>
</session-factory>
</hibernate-configuration>

Login.hbm.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mappong PUBLIC
  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  "http://hibernate.sourccforgc.net/hibernate mapping-3.0.dtd">

<hibernate-configuration>
<class name="hibernate.po.Login" table="login" schema="MYHR">
<id name="userName" type="java.lang.String">
<column name="username" length="20"/>
<gencerator class="assigned"/>
</id>
<property name="passWord" type="java.lang.String">
<column name="password" length="20" not-null="true"/>
</property>
</class>
</hibernate-configuration>

------解决方案--------------------
先检查jar包是否完整,再就是<gencerator class="assigned"/>这句貌似写错了,是你自己写的吗?
------解决方案--------------------
既然是新手,告诉你把
Login.hbm.xml里的 "http://hibernate.sourccforgc.net/hibernate mapping-3.0.dtd">改为
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
  相关解决方案