LinkageError:Spring项目中的重复类定义

时间:2012-09-17 10:51:29

标签: spring persistence james

有一个春天的非网络项目。 添加多个持久性单元会导致错误:

Caused by: java.lang.LinkageError: loader (instance of  sun/misc/Launcher$AppClassLoader): attempted  duplicate class definition for name: "org/springframework/stereotype/Service"

来自persistence.xml的行,当我删除一个单元错误时。

<persistence-unit name="James" transaction-type="RESOURCE_LOCAL">
            <!-- Mailbox stuff-->
            <class>org.apache.james.mailbox.jpa.mail.model.JPAMailbox</class>
            <class>org.apache.james.mailbox.jpa.mail.model.JPAUserFlag</class>
            <class>org.apache.james.mailbox.jpa.mail.model.openjpa.AbstractJPAMessage</class>
            <class>org.apache.james.mailbox.jpa.mail.model.openjpa.JPAMessage</class>
            <class>org.apache.james.mailbox.jpa.mail.model.openjpa.JPAMessage</class>
            <class>org.apache.james.mailbox.jpa.mail.model.JPAProperty</class>
            <class>org.apache.james.mailbox.jpa.user.model.JPASubscription</class>
            <class>org.apache.james.domainlist.jpa.model.JPADomain</class>
            <class>org.apache.james.user.jpa.model.JPAUser</class>
            <class>org.apache.james.rrt.jpa.model.JPARecipientRewrite</class>
            <class>com.merve.DenemeEntity</class>

            <properties>
                <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
                <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=cascade, JoinForeignKeyDeleteAction=cascade"/>
                <property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)"/>
                <property name="openjpa.jdbc.QuerySQLCache" value="false"/>
            </properties>

        </persistence-unit>

    <persistence-unit name="PU" transaction-type="RESOURCE_LOCAL">

           <properties>
                <property name="hibernate.hbm2ddl.auto" value="create" />
                <property name="hibernate.show_sql" value="false" />

                <property name="hibernate.max_fetch_depth" value="0"  />
                <property name="hibernate.cache.use_second_level_cache" value="true" />
                <property name="hibernate.cache.use_query_cache" value="false" />
                <property name="hibernate.cache.region.factory_class" value="net.sf.ehcache.hibernate.EhCacheRegionFactory" />

                <property name="hibernate.ejb.naming_strategy" value="aclass"/>

            </properties>

        </persistence-unit>

该项目不是我的,它是Apache James Server。我正在尝试添加addititonal persistence unit。我不认为这是詹姆斯特有的,我搜索网并遇到一个帖子,说明错误是在多次Singleton注入期间创建EntityManager的两个实例。 感谢您提供建议。

0 个答案:

没有答案