wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Conflicting persistence unit definitions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Conflicting persistence unit definitions" Watch "Conflicting persistence unit definitions" New topic

Conflicting persistence unit definitions

John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Spring 3.1.1
Maven 3.0.4
Eclipse wtp indigo

I am getting the following exception on server startup. I have just one persistence.xml in my project. Any ideas? Thanks Eric

Caused by: java.lang.IllegalStateException: Conflicting persistence unit definitions for name 'cassandra_pu': file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/cassandra/WEB-INF/classes/, file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/cassandra/WEB-INF/classes/
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.preparePersistenceUnitInfos(DefaultPersistenceUnitManager.java:362)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.afterPropertiesSet(DefaultPersistenceUnitManager.java:326)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:235)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 62 more

My context file:

My persistence.xml file is in META-INF where it should be:

Bill Gorder

Joined: Mar 07, 2010
Posts: 1648

If you use this

You should not even have a persistence.xml. Read the java doc for more info.

I would try either removing that line or removing your persistence.xml

[How To Ask Questions][Read before you PM me]
James Boswell

Joined: Nov 09, 2011
Posts: 1012


If you remove persistence.xml, where will "cassandra_pu" be defined?
Bill Gorder

Joined: Mar 07, 2010
Posts: 1648

You would set thetJpaPropertyMap and JpaVendorAdapter on the LocalContainerEntityManagerFactory.

I found a blog describing it here:

John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Thanks for the responses. I'll try it out.

I agree. Here's the link: http://aspose.com/file-tools
subject: Conflicting persistence unit definitions
Similar Threads
Cannot find the declaration of element 'beans' -- application context invalid?
Spring3/JPA2 configuration problem
yet another Spring-JPA-Hibernate config question
Conflict with <mvc:annotation-driven/>