title: Weblogic 12c and Spring-Data-JPA Deployment JPA 2.1 Conflict
body: <p>I'm trying to deploy a spring-data-jpa,apache-cxf integrated project to Oracle Weblogic 12c (12.1.3) with below dependencies and getting below exception.</p>
  
  <ul>
  <li>jdk :1.7</li>
  <li>weblogic : 12c(12.1.3)</li>
  <li>spring.version>4.1.0.RELEASE</li>
  <li>spring.data.version>1.7.2.RELEASE</li>
  <li>hibernate.version>4.3.11.Final</li>
  </ul>
  
  <p>So far I did;</p>
  
  <ul>
  <li>Tried to remove JPA 2.1 jar came from hibernate-entitymanager (didnt work,another exception thrown)</li>
  <li>Tried to figure out spring-data-jpa,spring and hibernate dependency check(not succeeded)</li>
  <li>Tried to give weblogic-applcation.xml for preferred-packages javax.persistence.* (doesn't change anything)</li>
  <li>Deployed to 12.2.1 and it does work</li>
  </ul>
  
  <p>I expect your valuable helps, thanks</p>
  
  <p>Exception</p>
  
  <pre><code>&lt;Warning&gt; &lt;HTTP&gt; &lt;BEA-101162&gt; &lt;User defined listener org.springframework.web.context.ContextLoaderListener failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/app-jpa-config.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/app-jpa-config.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229)
  Truncated. see log file for complete stacktrace 
  Caused By:java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
  at org.hibernate.cfg.AnnotationBinder.bindManyToOne(AnnotationBinder.java:2884)
  at org.hibernate.cfg.AnnotationBinder.bindOneToOne(AnnotationBinder.java:3051)
  at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1839)
  at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:963)
  at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:796)
  Truncated. see log file for complete stacktrace
  </code></pre>
  
  <blockquote>
    <p></p>
  </blockquote>
  
  <p>mvn pom.xml</p>
  
  <pre><code>&lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;spring.version&gt;4.1.0.RELEASE&lt;/spring.version&gt;
      &lt;spring.data.version&gt;1.7.2.RELEASE&lt;/spring.data.version&gt;
      &lt;hibernate.version&gt;4.3.11.Final&lt;/hibernate.version&gt;
      &lt;hibernate.validator.version&gt;5.1.2.Final&lt;/hibernate.validator.version&gt;
      &lt;cxf.version&gt;3.0.0&lt;/cxf.version&gt;
      &lt;log4j.version&gt;1.2.17&lt;/log4j.version&gt;
      &lt;junit.version&gt;4.12&lt;/junit.version&gt;
  &lt;/properties&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
          &lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;
          &lt;version&gt;${spring.data.version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-webmvc&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-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-framework-bom&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;type&gt;pom&lt;/type&gt;
          &lt;scope&gt;import&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;!-- Hibernate --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;${hibernate.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-transports-http&lt;/artifactId&gt;
          &lt;version&gt;${cxf.version}&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-frontend-jaxws&lt;/artifactId&gt;
          &lt;version&gt;${cxf.version}&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
  
  
      &lt;!-- LOG --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;${log4j.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
          &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
          &lt;version&gt;1.1.2&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                  &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;version&gt;1.7.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- TEST --&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;${junit.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Object2Object mapping --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.sf.dozer&lt;/groupId&gt;
          &lt;artifactId&gt;dozer&lt;/artifactId&gt;
          &lt;version&gt;5.5.1&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;!-- ORACLE --&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;/dependencies&gt;
  </code></pre>