title: Weblogic deployment causes - Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0'
body: <p>I am using Hibernate 4, Spring 3 , JSF 2.0 and Weblogic 10.3.6</p>
  
  <p>When I start weblogic server and server starts successfully, however whenever it starts publishing application, I am getting the following exception.</p>
  
  <pre><code>   Error creating bean with name 
   'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' 
    defined in ServletContext resource [/WEB-INF/applicationContext.xml]: 
    Initialization of bean failed; nested exception is 
    org.springframework.beans.factory.BeanCreationException: 
  
      Caused By: org.springframework.beans.factory.BeanCreationException: Error creating 
     bean with name 'entityManagerFactory'defined in ServletContext resource 
     [/WEB-INF/applicationContext.xml]: Invocation of init method failed; 
     nested exception is java.lang.NoSuchMethodError: 
     javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/
     SharedCacheMode;
  
  Caused By: java.lang.NoSuchMethodError: 
  javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()
  Ljavax/persistence /SharedCacheMode;    at 
  org.hibernate.ejb.util.LogHelper.logPersistenceUnitInfo(LogHelper.java:38)  at
  org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:525)
  at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:72)     at  org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManage
  </code></pre>
  
  <p>I have the following in applicationContext.xml</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"
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  http://www.springframework.org/schema/tx
  http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
  http://www.springframework.org/schema/context
  http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;      
      &lt;context:component-scan base-package="net.test" /&gt;
      &lt;!-- Data Source Declaration --&gt;
      &lt;bean id="DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
          destroy-method="close"&gt;
          &lt;property name="driverClass" value="oracle.jdbc" /&gt;
          &lt;property name="jdbcUrl" value="jdbc:oracle:thin:@server:1521:DB" /&gt;
          &lt;property name="user" value="scott" /&gt;
          &lt;property name="password" value="tiger" /&gt;
          &lt;property name="maxPoolSize" value="10" /&gt;
          &lt;property name="maxStatements" value="0" /&gt;
          &lt;property name="minPoolSize" value="5" /&gt;
      &lt;/bean&gt;
      &lt;bean
          class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /&gt;
      &lt;!-- JPA Entity Manager Factory --&gt;
      &lt;bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
          &lt;property name="dataSource" ref="DataSource" /&gt;
          &lt;property name="packagesToScan" value="net.test.entity" /&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="false" /&gt;
                  &lt;property name="databasePlatform" value="${jdbc.dialectClass}" /&gt;
  
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;bean id="defaultLobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler" /&gt;
      &lt;!-- Session Factory Declaration --&gt;
      &lt;bean id="SessionFactory"
          class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="DataSource" /&gt;
          &lt;property name="annotatedClasses"&gt;
              &lt;list&gt;
                  &lt;value&gt;net.test.entity.Department&lt;/value&gt;
                  &lt;value&gt;net.test.entity.Employees&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
          &lt;property name="hibernateProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.Oracle10gDialect&lt;/prop&gt;
                  &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                  &lt;prop key="hibernate.query.factory_class"&gt;org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory
                  &lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;!-- Enable the configuration of transactional behavior based on annotations --&gt;
      &lt;tx:annotation-driven transaction-manager="txManager" /&gt;
      &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
      &lt;!-- Transaction Config --&gt;
  
      &lt;bean id="txManager"
          class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="SessionFactory" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
          &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
      &lt;/bean&gt;
  
      &lt;context:annotation-config /&gt;    
  
      &lt;bean id="hibernateStatisticsMBean" class="org.hibernate.jmx.StatisticsService"&gt;
          &lt;property name="statisticsEnabled" value="true" /&gt;
          &lt;property name="sessionFactory" value="#{entityManagerFactory.sessionFactory}" /&gt;
      &lt;/bean&gt;
      &lt;bean name="ehCacheManagerMBean"
          class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" /&gt;
  
      &lt;bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"&gt;
          &lt;property name="locateExistingServerIfPossible" value="true" /&gt;
      &lt;/bean&gt;    
      &lt;bean id="jmxExporter" class="org.springframework.jmx.export.MBeanExporter"
          lazy-init="false"&gt;
          &lt;property name="server" ref="mbeanServer" /&gt;
          &lt;property name="registrationBehaviorName" value="REGISTRATION_REPLACE_EXISTING" /&gt;
          &lt;property name="beans"&gt;
              &lt;map&gt;
                  &lt;entry key="SpringBeans:name=hibernateStatisticsMBean"
                      value-ref="hibernateStatisticsMBean" /&gt;
                  &lt;entry key="SpringBeans:name=ehCacheManagerMBean" value-ref="ehCacheManagerMBean" /&gt;
              &lt;/map&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>pom.xml</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/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;net.test&lt;/groupId&gt;
      &lt;artifactId&gt;myappp&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; 
      &lt;name&gt;myappp&lt;/name&gt; 
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;prime-repo&lt;/id&gt;
              &lt;name&gt;PrimeFaces Maven Repository&lt;/name&gt;
              &lt;url&gt;http://repository.primefaces.org&lt;/url&gt;
              &lt;layout&gt;default&lt;/layout&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
      &lt;properties&gt;
          &lt;spring.version&gt;3.1.1.RELEASE&lt;/spring.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;!-- Spring 3 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;!-- JSF library --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.faces&lt;/groupId&gt;
              &lt;artifactId&gt;jsf-api&lt;/artifactId&gt;
              &lt;version&gt;2.1.6&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.faces&lt;/groupId&gt;
              &lt;artifactId&gt;jsf-impl&lt;/artifactId&gt;
              &lt;version&gt;2.1.6&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Primefaces library --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.primefaces&lt;/groupId&gt;
              &lt;artifactId&gt;primefaces&lt;/artifactId&gt;
              &lt;version&gt;3.4.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.primefaces.themes&lt;/groupId&gt;
              &lt;artifactId&gt;afterwork&lt;/artifactId&gt;
              &lt;version&gt;1.0.8&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Hibernate library --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;4.1.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javassist&lt;/groupId&gt;
              &lt;artifactId&gt;javassist&lt;/artifactId&gt;
              &lt;version&gt;3.12.1.GA&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.inject&lt;/groupId&gt;
              &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
              &lt;version&gt;1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Oracle Java Connector library --&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.3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;c3p0&lt;/groupId&gt;
              &lt;artifactId&gt;c3p0&lt;/artifactId&gt;
              &lt;version&gt;0.9.1.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Log4j library --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.16&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.testng&lt;/groupId&gt;
              &lt;artifactId&gt;testng&lt;/artifactId&gt;
              &lt;version&gt;6.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-jpamodelgen&lt;/artifactId&gt;
              &lt;version&gt;1.2.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;4.1.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-jpa-2.0-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.1.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
      &lt;groupId&gt;org.apache.myfaces.extensions.cdi.core&lt;/groupId&gt;
      &lt;artifactId&gt;myfaces-extcdi-core-api&lt;/artifactId&gt;
      &lt;version&gt;1.0.5&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
  &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-ehcache&lt;/artifactId&gt;
              &lt;version&gt;4.0.1.Final&lt;/version&gt;
          &lt;/dependency&gt;       
      &lt;/dependencies&gt; 
      &lt;build&gt;
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/resources&lt;/directory&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
  
          &lt;plugins&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;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                      &lt;compilerArgument&gt;-proc:none&lt;/compilerArgument&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.bsc.maven&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-processor-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.0.6&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;process&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;process&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;phase&gt;generate-sources&lt;/phase&gt;
                          &lt;configuration&gt;
                              &lt;!-- source output directory --&gt;
                              &lt;outputDirectory&gt;target/metamodel&lt;/outputDirectory&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  
  &lt;/project&gt;
  </code></pre>
  
  <p>In Weblogic 10.3.6 I have enabled JPA2 support by adding the following in <code>commEnv.cmd</code></p>
  
  <pre><code>@rem Enable JPA 2.0 functionality on WebLogic Server 
  set PRE_CLASSPATH=%BEA_HOME%\modules\javax.persistence_1.1.0.0_2-0.jar;
  %BEA_HOME%\modules\com.oracle.jpa2support_1.0.0.0_2-1.jar
  </code></pre>
  
  <p>How can I resolve this error?</p>