org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean is failing after upgrading spring–orm jar to 4.1.6
<p>Initially in our project we were using spring 3 + hibernate 3
Recently it has been decided to upgrade 3rd party jars, as part of that spring upgraded to 4 but not hibernate (still hibernate 3 is maintained).
Now we have not changed any code for spring 4 upgrade and when we execute project LocalContainerEntityManagerFactoryBean injection is failing. I have given context file declaration &amp; error stack trace in below. Now the question is how can I make existing project work on spring 4 with out upgrading hibernate.</p>

<p>With Spring ORM 4.1.6 LocalContainerEntityManagerFactoryBean is trying to load JPA 2.0 specific hibernate imports (that is hibernate 4 jar classes) and failing.   </p>

<pre><code>&lt;bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;

    &lt;property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml"/&gt;
    &lt;property name="persistenceUnitName" value="casp-portal"/&gt;
&lt;/bean&gt;
&lt;!-- Transaction manager for a single JPA EntityManagerFactory (alternative to JTA --&gt;
&lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
    &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt;
&lt;/bean&gt;
    &lt;!-- enable the configuration of transactional behavior based on annotations --&gt;
&lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
&lt;bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt;
</code></pre>

<h1>Error Stack trace</h1>

<blockquote>
  <p>Caused by: org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name 'entityManagerFactory' defined in class
  path resource [applicationContext-securityEJB-DBtest.xml]:
  Post-processing failed of bean type [class
  org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]
  failed; nested exception is java.lang.IllegalStateException: Failed to
  introspect bean class
  [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]
  for persistence metadata: could not find class that it depends on     at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:936)
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
    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.(ClassPathXmlApplicationContext.java:139)
    at
  org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)     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.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)  ...
  11 more Caused by: java.lang.IllegalStateException: Failed to
  introspect bean class
  [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]
  for persistence metadata: could not find class that it depends on     at
  org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:396)
    at
  org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:333)
    at
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:931)
    ... 44 more Caused by: java.lang.NoClassDefFoundError:
  javax/persistence/ValidationMode  at
  java.lang.Class.getDeclaredMethods0(Native Method)    at
  java.lang.Class.privateGetDeclaredMethods(Class.java:2615)    at
  java.lang.Class.getDeclaredMethods(Class.java:1860)   at
  org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:420)
    at
  org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:392)
    ... 46 more Caused by: java.lang.ClassNotFoundException:
  javax.persistence.ValidationMode  at
  java.net.URLClassLoader$1.run(URLClassLoader.java:366)    at
  java.net.URLClassLoader$1.run(URLClassLoader.java:355)    at
  java.security.AccessController.doPrivileged(Native Method)    at
  java.net.URLClassLoader.findClass(URLClassLoader.java:354)    at
  java.lang.ClassLoader.loadClass(ClassLoader.java:425)     at
  sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)     at
  java.lang.ClassLoader.loadClass(ClassLoader.java:358)     ... 51 more</p>
</blockquote>