hibernate的头痛问题,高手请帮帮我
启动tomcat服务器时没有报错,当提交请求时就出错了
报错如下
javax.servlet.ServletException: org.hibernate.HibernateException: [color=#FF0000]Could not parse configuration:
org.dom4j.DocumentException: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.[/color]
配置文件如下:
hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- local connection properties -->
<property name="hibernate.connection.url">
jdbc:mysql://localhost:3306/sas?useUnicode=true&characterEncoding=UTF-8
</property>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">123456</property>
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for MySQL -->
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.JDBCTransactionFactory
</property>
<mapping resource="sas/properties/Customer.hbm.xml" />
<mapping resource="sas/properties/Suggestion.hbm.xml" />
</session-factory>
</hibernate-configuration>
Customer.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="sas.beans.synbean">
<class
name="Customer"
table="customer"
>
<meta attribute="sync-DAO">true</meta>
<id
name="Id"
type="integer"
column="id"
>
<generator class="increment"/>
</id>
<property
name="CustomerName"
column="customerName"
type="string"
not-null="true"
length="45"
/>
<property
name="CustomerPwd"
column="customerPwd"
type="string"
not-null="true"
length="45"
/>
<set name="Suggestions" inverse="true" lazy="true">
<key column="id"/>
<one-to-many class="Suggestion"/>
</set>
</class>
</hibernate-mapping>
Suggestion.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="sas.beans.synbean">
<class
name="Suggestion"
table="suggestion"
>
<meta attribute="sync-DAO">true</meta>
<id
name="Id"
type="integer"
column="id"
>
<generator class="increment"/>
</id>
<property
name="Topic"
column="topic"
type="string"
not-null="true"
length="45"
/>
<property
name="Content"
column="content"
type="string"
not-null="true"
length="120"
/>
</class>
</hibernate-mapping>
请高手帮帮我吧,弄了几天了谢谢了