title: Conflicting persistence unit definitions exception
body: <p>I am getting the following exception on server startup. I have just one persistence.xml in my project. Any ideas?</p>
  
  <pre><code>weblogic.application.ModuleException: 
      at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1520)
      at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:484)
      at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
      at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
      Truncated. see log file for complete stacktrace
  Caused By: java.lang.IllegalStateException: Conflicting persistence unit definitions for name 'TRAVEL_SYSTEM_UNIT': file:/D:/TravelSystem/workspace-sts/Travel_System-EAR/EarContent/APP-INF/classes/, file:/D:/TravelSystem/workspace-sts/Travel_System-dataaccess/target/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)
      Truncated. see log file for complete stacktrace
  </code></pre>
  
  <p>My context file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
      xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:util="http://www.springframework.org/schema/util"
      xmlns:jee="http://www.springframework.org/schema/jee"
      xsi:schemaLocation=" http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
          http://www.springframework.org/schema/util  http://www.springframework.org/schema/util/spring-util-3.1.xsd
          http://www.springframework.org/schema/jee   http://www.springframework.org/schema/jee/spring-jee-3.1.xsd"&gt;
  
  
      &lt;context:annotation-config /&gt;
  
  
      &lt;context:component-scan base-package="com.dataaccess" /&gt;
  
      &lt;jee:jndi-lookup id="dataSource" jndi-name="jdbc/mysql" /&gt;
  
      &lt;bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource"&gt;&lt;/property&gt;
          &lt;property name="persistenceUnitName" value="SYSTEM_UNIT"&gt;&lt;/property&gt;
          &lt;property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml"/&gt;
          &lt;property name="packagesToScan" value="com.dataaccess.model"&gt;&lt;/property&gt;
          &lt;property name="jpaVendorAdapter"&gt;
              &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;&lt;/bean&gt;
          &lt;/property&gt;
          &lt;!-- &lt;property name="jpaVendorAdapter"&gt;
              &lt;bean id="jpaVendorAdapter"
                  class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
                  &lt;property name="generateDdl" value="true"&gt;&lt;/property&gt;
                  &lt;property name="showSql" value="true" /&gt;
              &lt;/bean&gt;
          &lt;/property&gt; --&gt;
  
      &lt;/bean&gt;
  
      &lt;bean class="org.springframework.transaction.jta.JtaTransactionManager" id="transactionManager"/&gt;
      &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
      &lt;bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/&gt;
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>My persistence.xml file is in META-INF where it should be:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
      version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"&gt;
      &lt;persistence-unit name="TRAVEL_SYSTEM_UNIT" transaction-type="JTA"&gt;
          &lt;jta-data-source&gt;jdbc/mysql&lt;/jta-data-source&gt;
          &lt;properties&gt;
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/&gt;
              &lt;property name="hibernate.max_fetch_depth" value="3" /&gt;
              &lt;property name="default_batch_fetch_size" value="25" /&gt;
              &lt;property name="hibernate.show_sql" value="false" /&gt; 
              &lt;property name="hibernate.format_sql" value="true" /&gt;
              &lt;property name="hibernate.generate_statistics" value="true" /&gt;
  &lt;!--            &lt;property name="hibernate.hbm2ddl.auto" value="update"/&gt; --&gt;
  
              &lt;property name="hibernate.transaction.manager_lookup_class" 
                  value="org.hibernate.transaction.SunONETransactionManagerLookup" /&gt;
          &lt;/properties&gt;
  
      &lt;/persistence-unit&gt;
  
  &lt;/persistence&gt; 
  </code></pre>
  
  <p>using 3.1.2.RELEASE Maven 3.0.4 </p>