例外:元素类型“hibernate-mapping”的内容必须匹配“

时间:2022-11-30 16:57:20

I'm getting the following error:

我收到以下错误:

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

Then further down the cause is revealed:

然后进一步向下揭示了原因:

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)

The exception is referencing the file applicationContext_AuthService.xml. In there I have the following mappings:

例外是引用文件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>

The second one is hib/userapp/Authorization.hbm.xml. Here is that file:

第二个是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>

This is the one that I think it is complaining about. It is valid xml according to XMLSpy.

这是我认为它抱怨的那个。根据XMLSpy,它是有效的xml。

Anybody have any ideas as to what I'm doing wrong?

有人对我做错了什么有任何想法吗?

Thanks in advance,

提前致谢,

Andrew

安德鲁

1 个解决方案

#1


1  

You're missing the last line, unless that's a copy-paste error:

你错过了最后一行,除非这是一个复制粘贴错误:

</hibernate-mapping>

Can you confirm that it's this file? Try commenting it out and see if the error disappears (or gives a different one).

你能确认一下这个文件吗?尝试将其评论出来,看看错误是否消失(或者给出了不同的错误)。

#1


1  

You're missing the last line, unless that's a copy-paste error:

你错过了最后一行,除非这是一个复制粘贴错误:

</hibernate-mapping>

Can you confirm that it's this file? Try commenting it out and see if the error disappears (or gives a different one).

你能确认一下这个文件吗?尝试将其评论出来,看看错误是否消失(或者给出了不同的错误)。