i am trying to add addititonal `persistence unit`. I do not think it is
specific to James, I searched net and ran into a post (independent from
James, only related to Spring and java) that says the error is about
creating two instances of a `Singleton` during multiple `EntityManager`
injection. I think it is not specific to James but i think maybe you have
some idea.
Adding multiple persistence units causes error:
Caused by: java.lang.LinkageError: loader (instance of
sun/misc/Launcher$AppClassLoader): attempted duplicate class definition
for name: "org/springframework/stereotype/Service"
Lines from persistence.xml, when i delete one unit error is out.
<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>
Thanks for possible advices.