title: org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter ERROR
body: <p>I want to test my application-context.xml if it is well configured or not. So,this is what I did :</p>
  
  <pre><code>     public static void main( String[] args )
  {
  
      ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring/context/application-context.xml");
      applicationContext.getBean("entityManagerFactory");
  }
  </code></pre>
  
  <p>I got this issue with the entityManagerFactory<br>
  I am pretty sure that my dependencies are all compatible and the hibernate-entitymanager is available in my repository.</p>
  
  <p><strong>My error:</strong> </p>
  
  <pre><code>        org.springframework.context.support.ClassPathXmlApplicationContext #prepareRefresh
       INFOS: Refreshing 
  
        org.springframework.context.support.ClassPathXmlApplicationContext@3dd6e4a4: startup date [Thu Mar 12 17:02:52 CET 2015]; root of context hierarchy              org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
      INFOS: Loading XML bean definitions from class path resource [spring/context/application-context.xml]
      org.springframework.jdbc.datasource.DriverManagerDataSource    setDriverClassName
       INFOS: Loaded JDBC driver: oracle.jdbc.OracleDriver
      org.springframework.context.support.ClassPathXmlApplicationContext refresh
       AVERTISSEMENT: Exception encountered during context initialization - cancelling refresh attempt
       org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource   [spring/context/application-context.xml]: Cannot create inner bean 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#9be2c6f' of type [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] while setting bean property 'jpaVendorAdapter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#9be2c6f' defined in class path resource [spring/context/application-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Failed to determine Hibernate PersistenceProvider
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1469)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:956)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:747)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
      at com.app.tn.App.main(App.java:15)
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#9be2c6f' defined in class path resource [spring/context/application-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Failed to determine Hibernate PersistenceProvider
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1093)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1038)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:299)
      ... 15 more
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Failed to determine Hibernate PersistenceProvider
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1086)
      ... 19 more
  Caused by: java.lang.IllegalStateException: Failed to determine Hibernate PersistenceProvider
      at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.&lt;init&gt;(HibernateJpaVendorAdapter.java:96)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
      ... 21 more
  Caused by: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernateEntityManagerFactory
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.&lt;init&gt;(HibernateJpaVendorAdapter.java:89)
      ... 26 more
  
  Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/context/application-context.xml]: Cannot create inner bean 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#9be2c6f' of type [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] while setting bean property 'jpaVendorAdapter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#9be2c6f' defined in class path resource [spring/context/application-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Failed to determine Hibernate PersistenceProvider
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1469)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:956)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:747)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
      at com.app.tn.App.main(App.java:15)
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#9be2c6f' defined in class path resource [spring/context/application-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Failed to determine Hibernate PersistenceProvider
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1093)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1038)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:299)
      ... 15 more
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Failed to determine Hibernate PersistenceProvider
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1086)
      ... 19 more
  Caused by: java.lang.IllegalStateException: Failed to determine Hibernate PersistenceProvider
      at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.&lt;init&gt;(HibernateJpaVendorAdapter.java:96)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
      ... 21 more
  #Caused by: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernateEntityManagerFactory
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.&lt;init&gt;(HibernateJpaVendorAdapter.java:89)
      ... 26 more
  </code></pre>
  
  <p>and this is my <strong>application-context</strong> file:</p>
  
  <pre><code>   &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:task="http://www.springframework.org/schema/task"
  xsi:schemaLocation="       
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
            http://www.springframework.org/schema/task
     http://www.springframework.org/schema/task/spring-task-4.0.xsd"  default-autowire="byName"&gt;
  
  &lt;!-- ========================= CONFIG DEFINITIONS ========================= --&gt;
  &lt;!-- Activates various annotations to be detected in bean classes: Spring's @Required, @Autowired, @Service, @repository, â€¦ --&gt;
  &lt;context:component-scan base-package="com.app.tn.*" /&gt;
  &lt;context:annotation-config /&gt;
  &lt;task:annotation-driven /&gt;
  
  &lt;!-- Entity manager factory declaration --&gt;
  &lt;bean id="entityManagerFactory"     class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
  
      &lt;!-- reference to the datasource --&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
  
      &lt;!-- Persistence unit manager --&gt;
      &lt;property name="persistenceUnitManager" ref="persistenceUnitManager" /&gt;
  
      &lt;!-- specify Hibernate as the the JPA provider --&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="database" value="org.springframework.orm.jpa.vendor.Database.ORACLE" /&gt;
          &lt;/bean&gt;
  
       &lt;/property&gt;
      &lt;property name="jpaPropertyMap"&gt;
          &lt;map&gt;
              &lt;entry key="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/&gt;
              &lt;entry key="formatSql" value="true"/&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  
  
  &lt;/bean&gt;   
  
  &lt;!-- Persistence unit declaration --&gt;
  &lt;bean id="persistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager"&gt;
      &lt;property name="defaultDataSource" ref="dataSource" /&gt;
      &lt;property name="loadTimeWeaver"&gt;
          &lt;bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" /&gt;
      &lt;/property&gt;
  &lt;/bean&gt; 
  
  &lt;!-- DataSource declaration --&gt;
  &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="oracle.jdbc.OracleDriver" /&gt;
      &lt;property name="url" value="jdbc:oracle:thin:@localhost:1521:XE" /&gt;
      &lt;property name="username" value="*******" /&gt;
      &lt;property name="password" value="*******" /&gt;
  &lt;/bean&gt;
  
  &lt;!-- The transaction manager declaration --&gt;
  &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
      &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
  &lt;/bean&gt;
  &lt;bean id="transactionTemplate"
      class="org.springframework.transaction.support.TransactionTemplate"&gt;
      &lt;property name="transactionManager" ref="transactionManager" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>
          
      &lt;/bean>
      -->
  </p>
  
  <p>My <strong>pom</strong> file :</p>
  
  <pre><code>           &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;com.app.tn&lt;/groupId&gt;
    &lt;artifactId&gt;projet-db&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
  
    &lt;name&gt;app-db&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
  
    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;targetJdk&gt;1.7&lt;/targetJdk&gt;
      &lt;spring.version&gt;4.1.5.RELEASE&lt;/spring.version&gt;
    &lt;/properties&gt;
  
  &lt;build&gt;
  
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
                  &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
                  &lt;!-- or if you want to use tomcat 6.x &lt;artifactId&gt;tomcat6-maven-plugin&lt;/artifactId&gt; --&gt;
                  &lt;version&gt;2.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;!-- http port --&gt;
                      &lt;port&gt;8080&lt;/port&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;${targetJdk}&lt;/source&gt;
                      &lt;target&gt;${targetJdk}&lt;/target&gt;
                      &lt;encoding&gt;${sourceEncoding}&lt;/encoding&gt;
                      &lt;showDeprecation&gt;true&lt;/showDeprecation&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
    &lt;dependencies&gt;
          &lt;!-- ORACLE JDBC driver, need install yourself --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.oracle&lt;/groupId&gt;
              &lt;artifactId&gt;ojdbc6&lt;/artifactId&gt;
              &lt;version&gt;11.2.0&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;!-- Hibernate Framework --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;4.3.8.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.javassist&lt;/groupId&gt;
              &lt;artifactId&gt;javassist&lt;/artifactId&gt;
              &lt;version&gt;3.19.0-GA&lt;/version&gt;
          &lt;/dependency&gt;
  
              &lt;!-- Hibernate c3p0 connection pool --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-c3p0&lt;/artifactId&gt;
              &lt;version&gt;3.3.2.GA&lt;/version&gt;
          &lt;/dependency&gt;
  
              &lt;!-- Spring 4 dependencies --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;   
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Thanks in advance for your help</p>