有一个春季非网络项目。添加多个持久性单元会导致错误:
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。我正在尝试添加其他内容persistence unit
。我认为这不是 James 特有的,我在网上搜索并遇到一篇帖子,上面说错误是关于Singleton
在多次EntityManager
注入期间创建 a 的两个实例。感谢您提供可能的建议。