2011-12-01 40 views
0

例外:元素類型的內容「休眠映射」必須我收到以下錯誤匹配「

<my correct path>/applicationContext_AuthService.xml]: Invocation of init method failed;  nested exception is org.hibernate.InvalidMappingException: Unable to read XML 

再往原因揭曉:

Caused by: org.xml.sax.SAXParseException: The content of element type "hibernate-mapping" must match "(meta*,identifier-generator*,typedef*,filter-def*,import*,(class|subclass|joined-subclass|union-subclass)*,resultset*,(query|sql-query)*,filter-def*,fetch-profile*,database-object*)". 
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) 
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131) 

異常是引用文件applicationContext_AuthService.xml在那裏我有以下映射:

<bean id="UserAPPSessionFactory" 
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
    <property name="dataSource"> 
     <ref bean="UserAPP" /> 
    </property> 
    <property name="mappingResources"> 
     <list> 
      <!-- value>hib/userapp/ActionImpl.hbm.xml</value --> 
      <value>hib/userapp/ActivityCode.hbm.xml</value> 
      <value>hib/userapp/Authorization.hbm.xml</value> 
      <value>hib/userapp/Contacts.hbm.xml</value> 
      <value>hib/userapp/CorrectionRequests.hbm.xml</value> 
      <!-- value>hib/userapp/CSRHistory.hbm.xml</value --> 
      <value>hib/userapp/Csrusers.hbm.xml</value> 
      <value>hib/userapp/Customer.hbm.xml</value> 
      <value>hib/userapp/CustomerTypeImpl.hbm.xml</value> 
      <value>hib/userapp/DocumentAssociationCrosswalk.hbm.xml</value> 
      <value>hib/userapp/DocumentImpl.hbm.xml</value> 
      <value>hib/userapp/KeyDB.hbm.xml</value> 
      <value>hib/userapp/KeyDBFirst.hbm.xml</value> 
      <value>hib/userapp/NotesImpl.hbm.xml</value> 
      <value>hib/userapp/Product.hbm.xml</value> 
      <value>hib/userapp/RatesImpl.hbm.xml</value> 
      <value>hib/userapp/ReminderImpl.hbm.xml</value> 
      <value>hib/userapp/YearImpl.hbm.xml</value> 
     </list> 
    </property> 

第二一個是hib/userapp/Authorization.hbm.xml。下面是該文件:

<?xml version="1.0"?> 
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 
    <!-- Generated Aug 17, 2011 3:35:48 PM by Hibernate Tools 3.4.0.CR1 --> 
    <hibernate-mapping> 
     <class name="com.eagle.customer.impl.AuthorizationImpl" table="CustomerAuthorization" 
    schema="dbo" catalog="UserAPP"> 
    <cache usage="read-write" /> 
    <id name="custId" type="string"> 
     <column name="CustID" length="10" /> 
     <generator class="assigned" /> 
    </id> 
    <property name="password" type="string"> 
     <column name="Password" length="15" /> 
    </property> 
    <property name="custType" type="string"> 
     <column name="CustType" length="10" /> 
    </property> 
    <property name="authLevel" type="string"> 
     <column name="AuthLevel" length="2" /> 
    </property> 
    <property name="custStatus" type="string"> 
     <column name="CustStatus" length="10" /> 
    </property> 
    <property name="vincaptureHbm" type="string"> 
     <column name="VINCapture" length="1" /> 
    </property> 
    <property name="mileageReportHbm" type="string"> 
     <column name="MileageReport" length="1" /> 
    </property> 
</class> 

這是我認爲這是在抱怨之一。根據XMLSpy,它是有效的xml。

任何人有什麼想法,我做錯了什麼?

由於提前,

安德魯

+0

對於有這個問題的其他人,我的''標籤不在''父節點的最後一個標籤中。 –

回答

1

你錯過了最後一行,除非這是一個複製粘貼錯誤:

</hibernate-mapping> 

你能否證實它的這個文件?嘗試將其評論出來,看看錯誤是否消失(或給出不同的)。

相關問題