title: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContexte.xml]
body: <p>I have this problem !</p>
  
  <pre><code> java.lang.AssertionError: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContexte.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: UP_GAB] Unable to build EntityManagerFactory
          at org.junit.Assert.fail(Assert.java:91)
          at org.junit.Assert.assertTrue(Assert.java:43)
          at com.bits.gabrent.TestJPA.test(TestJPA.java:21)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
          at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
          at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
          at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
  </code></pre>
  
  <p>this is my applicationContexte 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: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/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"&gt;
  &lt;!--
  &lt;bean id="datasource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName" value= "oracle.jdbc.driver.OracleDriver"&gt;&lt;/property&gt;
          &lt;property name="url" value= "jdbc:oracle:thin:@host:8080:gab"&gt;&lt;/property&gt;
          &lt;property name="username" value= "issam"&gt;&lt;/property&gt;
          &lt;property name="password" value= "admin123" &gt;&lt;/property&gt; --&gt;
  
          &lt;bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close"&gt;
          &lt;property name="connectionCachingEnabled" value="true"/&gt;
          &lt;property name="URL" value="jdbc:oracle:thin:localhost:1521:xe"/&gt;
          &lt;property name="user" value="issam"/&gt;
          &lt;property name="password" value="admin123"/&gt;
  
  
  
  &lt;/bean&gt;
  
  &lt;bean id= "persistenceUnitManager" class= "org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager"&gt;
          &lt;property name= "persistenceXmlLocations"&gt;
          &lt;list&gt;
          &lt;value&gt;classpath*:META-INF/persistence.xml&lt;/value&gt;
          &lt;/list&gt;
          &lt;/property&gt;
          &lt;property name= "defaultDataSource" ref= "dataSource"&gt;&lt;/property&gt;
   &lt;/bean&gt;
  
  &lt;bean id= "entityManagerFactory" class= "org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
  &lt;property name= "persistenceUnitManager" ref= "persistenceUnitManager"&gt;&lt;/property&gt;
  &lt;property name= "persistenceUnitName" value= "UP_GAB"&gt;&lt;/property&gt;
  &lt;/bean&gt;  
  
  
  
  
  &lt;bean id="transactionManager" class= "org.springframework.orm.jpa.JpaTransactionManager"&gt;
  &lt;property name= "entityManagerFactory" ref= "entityManagerFactory"&gt;&lt;/property&gt;
  &lt;/bean&gt;
  &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>My persistence.xml file : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_0.xsd "&gt;
    &lt;persistence-unit name="UP_GAB" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
          &lt;properties&gt;
          &lt;property name= "hibernate.show_sql" value= "true"/&gt;
          &lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt;
          &lt;property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" /&gt;
          &lt;property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/&gt;
          &lt;property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:xe"/&gt;
          &lt;property name="javax.persistence.jdbc.user" value="issam"/&gt;
          &lt;property name="javax.persistence.jdbc.password" value="admin123"/&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>I visited some Questions that may already have the answer but i don't found the solution
  Thanks for your help ! </p>