title: "javax.persistence.SynchronizationType"'s signer information does not match signer information of other classes in the same package
body: <p>I am trying to connect to Oracle data base using JPA through a Spring Boot Application. I initially got the error saying </p>
  
  <pre><code>java.lang.NoSuchMethodError: javax.persistence.PersistenceContext.synchronization()Ljavax/persistence/SynchronizationType
  </code></pre>
  
  <p>I did a search on how to recitify the same and found that o resolve the same I should use version from 2.1.0 for the javax.persistence dependency.</p>
  
  <pre><code>      &lt;dependency&gt;
              &lt;groupId&gt;org.eclipse.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;javax.persistence&lt;/artifactId&gt;
              &lt;version&gt;2.2.0&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>Upon changing the same, the error is resolved, but I am getting another error now:</p>
  
  <pre><code>
  java.lang.SecurityException: class "javax.persistence.SynchronizationType"'s signer information does not match signer information of other classes in the same package
  
  </code></pre>
  
  <p>Here is my pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.0.3.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
  
      &lt;groupId&gt;com.in28minutes&lt;/groupId&gt;
      &lt;artifactId&gt;in28Minutes-first-webapp&lt;/artifactId&gt;
      &lt;version&gt;2.1.3.RELEASE&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
  
      &lt;dependencies&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.glassfish.main.extras&lt;/groupId&gt;
      &lt;artifactId&gt;glassfish-embedded-all&lt;/artifactId&gt;
      &lt;version&gt;3.1.2.2&lt;/version&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
  
  &lt;exclusions&gt;
      &lt;exclusion&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
      &lt;/exclusion&gt;
  
      &lt;exclusion&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-nop&lt;/artifactId&gt;
      &lt;/exclusion&gt;
      &lt;exclusion&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-jdk14&lt;/artifactId&gt;
      &lt;/exclusion&gt;
  
  &lt;/exclusions&gt; 
  
  
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
               &lt;exclusions&gt;
      &lt;exclusion&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
      &lt;/exclusion&gt;
    &lt;/exclusions&gt;
  
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
  
  
  
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
           &lt;dependency&gt;
          &lt;groupId&gt;com.oracle&lt;/groupId&gt;
          &lt;artifactId&gt;ojdbc14&lt;/artifactId&gt;
          &lt;version&gt;12.1.0.2&lt;/version&gt;
      &lt;/dependency&gt;
  
  
  
  
  
  
        &lt;!-- Java 8 = JAX-B Version 2.2.8  added to correct missing entity manager error--&gt;
       &lt;dependency&gt;
              &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
              &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
              &lt;groupId&gt;javax&lt;/groupId&gt;
              &lt;artifactId&gt;javaee-web-api&lt;/artifactId&gt;
              &lt;version&gt;6.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
  
  
  
                &lt;dependency&gt;
              &lt;groupId&gt;org.eclipse.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;javax.persistence&lt;/artifactId&gt;
              &lt;version&gt;2.2.0&lt;/version&gt;
          &lt;/dependency&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.4.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;5.2.3.Final&lt;/version&gt;
  &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&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;verbose&gt;true&lt;/verbose&gt;
                          &lt;source&gt;1.8&lt;/source&gt;
                          &lt;target&gt;1.8&lt;/target&gt;
                          &lt;showWarnings&gt;true&lt;/showWarnings&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
                      &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.2&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;path&gt;/&lt;/path&gt;
                          &lt;contextReloadable&gt;true&lt;/contextReloadable&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-snapshots&lt;/id&gt;
              &lt;name&gt;Spring Snapshots&lt;/name&gt;
              &lt;url&gt;https://repo.spring.io/snapshot&lt;/url&gt;
              &lt;snapshots&gt;
                  &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;/snapshots&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-milestones&lt;/id&gt;
              &lt;name&gt;Spring Milestones&lt;/name&gt;
              &lt;url&gt;https://repo.spring.io/milestone&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
      &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;spring-snapshots&lt;/id&gt;
              &lt;name&gt;Spring Snapshots&lt;/name&gt;
              &lt;url&gt;https://repo.spring.io/snapshot&lt;/url&gt;
              &lt;snapshots&gt;
                  &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;/snapshots&gt;
          &lt;/pluginRepository&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;spring-milestones&lt;/id&gt;
              &lt;name&gt;Spring Milestones&lt;/name&gt;
              &lt;url&gt;https://repo.spring.io/milestone&lt;/url&gt;
          &lt;/pluginRepository&gt;
      &lt;/pluginRepositories&gt;
  
  &lt;/project&gt;
  
  </code></pre>
  
  <p>My application class:</p>
  
  <pre><code>package com.myfirst.classes.from.db;
  
  
  import java.util.Date;
  
  //import org.slf4j.LoggerFactory;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.boot.CommandLineRunner;
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration;
  import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
  import org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguration;
  import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
  //import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
  import org.springframework.stereotype.Component;
  
  //import com.example.database.databasejdbcdemo.SpringDataDemoApplication;
  
  
  /*@EnableAutoConfiguration(exclude = {
          JndiConnectionFactoryAutoConfiguration.class,
           HibernateJpaAutoConfiguration.class,
          JpaRepositoriesAutoConfiguration.class,
          DataSourceTransactionManagerAutoConfiguration.class,
          SecurityAutoConfiguration.class,DataSourceAutoConfiguration.class })*/
  
  //@EnableJpaRepositories(basePackages="com.myfirst.classes.from.db")
  @ComponentScan("com.myfirst.classes.from.db")
  @SpringBootApplication
  
  
  public class SpringDataDemoApplication implements CommandLineRunner{
  
      //private org.slf4j.Logger logger= LoggerFactory.getLogger(this.getClass());
  
      @Autowired
      PersonSpringDataRepository repository ;
  
      public static void main(String[] args) {
          SpringApplication.run(SpringDataDemoApplication.class, args);
      }
  
      @Override
      public void run(String... args) throws Exception {
  
          System.out.println("hello");
          //logger.info("Person with ID 10002 -&gt;{}",repository.findById(10002));
          //logger.info("Updating person with ID 10002 -&gt;{}",repository.save(new Person(10002,"Kunjol","Home",new Date())));
          //logger.info("Person with ID 10002 -&gt;{}",repository.findById(10002));
          //logger.info("Inserting a new person now -&gt;{}",repository.save(new Person(10007,"Karthik","Home",new Date())));
          //logger.info("Person with ID 10007 -&gt;{}",repository.findByName("Karthik"));
      //repository.deleteById(10001);
      //logger.info("Person with ID 10001 -&gt;{}",repository.findById(10001));
  
      }
  
  }
  
  </code></pre>
  
  <p>PersonSpringDataRepository.java</p>
  
  <pre><code>package com.myfirst.classes.from.db;
  
  import javax.persistence.EntityManagerFactory;
  
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.stereotype.Component;
  import org.springframework.stereotype.Repository;
  import org.springframework.transaction.annotation.Transactional;
  
  @Component
  @Transactional
  
  public interface PersonSpringDataRepository extends JpaRepository&lt;Person,Integer&gt; {
  
  
  }
  
  
  </code></pre>
  
  <p>And the Person.java</p>
  
  <pre><code>package com.myfirst.classes.from.db;
  
  import java.util.Date;
  
  import javax.persistence.Entity;
  import javax.persistence.EntityManagerFactory;
  import javax.persistence.GeneratedValue;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  import org.springframework.boot.context.properties.ConfigurationProperties;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.stereotype.Component;
  import org.springframework.stereotype.Repository;
  
  
  @Entity
  @Table(name="person")
  
  @Configuration
  @ConfigurationProperties("oracle")
  
  public class Person {
  
  //  private EntityManagerFactory entityManagerFactory;
  
      @Id
      @GeneratedValue
  //  @Bean
      private int id;
      private String name;
      private String location;
      private Date birth_date;
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
      public String getLocation() {
          return location;
      }
      public void setLocation(String location) {
          this.location = location;
      }
      public Date getBirth_date() {
          return birth_date;
      }
      public void setBirth_date(Date birth_date) {
          this.birth_date = birth_date;
      }
      public Person(int id, String name, String location, Date birth_date) {
          super();
          this.id = id;
          this.name = name;
          this.location = location;
          this.birth_date = birth_date;
      }
  
      public Person( String name, String location, Date birth_date) {
          super();
  
          this.name = name;
          this.location = location;
          this.birth_date = birth_date;
      }
  
      public  Person()
      {
          //By default, Spring will try to instantiate beans by calling a default (no-arg) constructor.
      }
      @Override
      public String toString() {
          return "Person [id=" + id + ", name=" + name + ", location=" + location + ", birth_date=" + birth_date + "]";
      }
  }
  
  </code></pre>
  
  <p>What could be the possible reason for the issue? Any help would be highly appreciated.</p>