title: Error creating bean with name 'entityManagerFactory' -> Cannot parse persistence unit from class path resource [META-INF/persistence.xml]
body: <p>I have this problem in my j2e application and I can't find any solution.
  Build was successful but there is thrown runtime exception. I tried many advices from google but nothing can solve my problem.</p>
  
  <pre><code>SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/datasource-config.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Cannot parse persistence unit from class path resource [META-INF/persistence.xml]
  </code></pre>
  
  <p>entityManagerFactory in data-source</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd         
                      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"&gt;
  
  
  &lt;bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource" &gt;
      &lt;property name="connectionCachingEnabled" value="true" /&gt;
      &lt;property name="URL" value="jdbc:postgresql://localhost:5432/postgres" /&gt;
      &lt;property name="user" value="postgres" /&gt;
      &lt;property name="password" value="" /&gt;
  &lt;/bean&gt;
  
  
  &lt;bean id="entityManagerFactory"
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
      &lt;property name="jpaVendorAdapter"&gt;
          &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
              &lt;property name="showSql" value="true" /&gt;
              &lt;property name="generateDdl" value="true" /&gt;
              &lt;property name="databasePlatform" value="org.hibernate.dialect.PostgreSQLDialect" /&gt;
          &lt;/bean&gt;
      &lt;/property&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="persistenceUnitName" value="default" /&gt;
  </code></pre>
  
  <p>
      </p>
  
  <pre><code>&lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
  &lt;/bean&gt;
  
  &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
  
  &lt;bean
      class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>persistence.xml</p>
  
  <pre><code> &lt;persistence-unit name="default" transaction-type="RESOURCE_LOCAL"&gt;
  
              &lt;class&gt;com.example.j2eeapp.domain.UserEntity&lt;/class&gt;
  
      &lt;/persistence-unit&gt;
  </code></pre>