title: java.lang.NoClassDefFoundError: org/hibernate/metamodel/source/annotations/JPADotNames Error
body: <p>I am a complete newbie in springboot and hibernate and jpa. I posted a question earlier but somehow or the other solved that but now I am stuck at another huge error.</p>
  
  <p>I was trying to have two separate tables from a same database. Two have their own model as well as repository classes. The code is running fluently when there is just a single table being processed but when two tables are being processed this error is causing:</p>
  
  <pre><code>2019-06-16 00:38:12.178  INFO 14868 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.12.Final}
  2019-06-16 00:38:12.180  INFO 14868 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
  2019-06-16 00:38:12.181  INFO 14868 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
  2019-06-16 00:38:12.226  WARN 14868 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/metamodel/source/annotations/JPADotNames
  Sun Jun 16 00:38:12 IST 2019 WARN: Caught while disconnecting...  goes on and on....
  </code></pre>
  
  <p>applications.yml</p>
  
  <pre><code>spring:
  
    datasource:
      url: jdbc:mysql://localhost:3306/test_schema
      username: root
      password: user
      driverClassName: com.mysql.jdbc.Driver
  
    jpa:
  
      generate-ddl: true
      show-sql: true
  </code></pre>
  
  <p>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;groupId&gt;com.techprimers.db&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-mysqldb&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;spring-boot-cleardb&lt;/name&gt;
      &lt;description&gt;Demo project for Spring Boot&lt;/description&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;1.5.2.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
          &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
          &lt;version&gt;2.3.0&lt;/version&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-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;8.0.11&lt;/version&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;/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.3.8.Final&lt;/version&gt;
  &lt;/dependency&gt;
  
      &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate.common&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-commons-annotations&lt;/artifactId&gt;
      &lt;version&gt;5.0.1.Final&lt;/version&gt;
  &lt;/dependency&gt;
      &lt;dependency&gt;
      &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
       &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
      &lt;version&gt;2.3.0&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;/plugins&gt;
      &lt;/build&gt;
  
  
  &lt;/project&gt;
  
  </code></pre>
  
  <p>InterestDao.java  - Dao Class 1</p>
  
  <pre><code>package com.techprimers.db.dao;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  
  import com.techprimers.db.model.Interest;
  import com.techprimers.db.repository.InterestRepository;
  
  @Service
  public class InterestDao{
  
  
      @Autowired
      InterestRepository interrepo;
  
      public Interest findOne(String token) {
          return interrepo.findOne(token);
      }
  
  }
  </code></pre>
  
  <p>usersdao.java - Dao Class 2</p>
  
  <pre><code>package com.techprimers.db.dao;
  
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  
  
  import com.techprimers.db.model.Users;
  import com.techprimers.db.repository.UsersRepository;
  
  @Service
  public class userdao {
  
  
      @Autowired
      UsersRepository userrepo;
  
      public Users findOne(String token) {
          return userrepo.findOne(token);
      }
  
  
  
  }
  
  </code></pre>
  
  <p>Interest.java - Model Class 1</p>
  
  <pre><code>package com.techprimers.db.model;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Table;
  
  import org.springframework.stereotype.Repository;
  
  @Repository
  @Entity
  @Table(name="hb_interest")
  public class Interest{
  
      @Column(name="ticket_no")
      private String ticket_no;
  
      @Column(name="hb_type")    
      private String hb_type;
  
      @Column(name="hb_unit_hints")
      private String hb_unit_hints;
  
      @Column(name="hb_value")
      private float hb_value;
  
      public Interest() {
      }
  
  
  
      //getters and setters......
  
  
      @Override
      public String toString() {
          return "{" +
                  "\"ticket_no\":" +"\"" + ticket_no + "\""+"," +
                  "\"Genre\":" +"\""+ hb_type + "\""+","+
                  "\"Powers\":"+"\"" + hb_unit_hints +"\""+
                  "\"Characters_No\":"+"\"" + hb_value +"\""+
                  '}';
      }
  
  
  }
  
  </code></pre>
  
  <p>Users.java   Model class 2</p>
  
  <pre><code>package com.techprimers.db.model;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  import org.springframework.stereotype.Repository;
  
  
  @Repository
  @Entity
  @Table(name="persons")
  public class Users {
  
  
      @Column(name = "id")
      private Integer id;
      @Column(name = "name")
      private String name;
  
      @Id
      @Column(name = "token_id")
      private String teamName;
      @Column(name = "salary")
      private Integer salary;
  
      public Users() {
      }
  
    //getters and setters....
  
  
      @Override
      public String toString() {
          return "{" +
                  "\"id\":" +"\"" + id + "\""+"," +
                  "\"value\":" +"\""+ name + "\""+","+
                  "\"Anime\":"+"\"" + teamName +"\""+
                  '}';
      }
  
  }
  
  </code></pre>
  
  <p>InterestRepository.java  </p>
  
  <pre><code>package com.techprimers.db.repository;
  
  import org.springframework.data.jpa.repository.JpaRepository;
  
  import com.techprimers.db.model.Interest;
  
  
  
  public interface InterestRepository extends JpaRepository&lt;Interest, String&gt; {
  
  }
  </code></pre>
  
  <p>UsersRepository.java </p>
  
  <pre><code>package com.techprimers.db.repository;
  
  import com.techprimers.db.model.Users;
  import org.springframework.data.jpa.repository.JpaRepository;
  
  public interface UsersRepository extends JpaRepository&lt;Users, String&gt; {
  }
  
  
  </code></pre>
  
  <p>UsersResource.java  The Controller Class</p>
  
  <pre><code>package com.techprimers.db.resource;
  
  import com.techprimers.db.dao.InterestDao;
  import com.techprimers.db.dao.userdao;
  
  import org.json.simple.JSONObject;
  import org.json.simple.parser.JSONParser;
  import org.json.simple.parser.ParseException;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.*;
  
  @RestController
  @RequestMapping(value = "/rest/users")
  public class UsersResource {
  
      @Autowired
      userdao userDao;
      InterestDao interdao;
  
      @Autowired
      ProcessData pd;
  
       @GetMapping("/persons")
       public JSONObject loadPersons(@RequestParam("access_token") String access_token) throws  ParseException{
          String decode_token = pd.testDecodeJWT(access_token); // Function to decode the access token
          String token = pd.jsondata(decode_token);//Fetch the token from the decoded access token
          String data= userDao.findOne(token).toString();//Convert the response data from table 1 to JSON String.
          String med= interdao.findOne(token).toString();//Convert the response data from table 2 to JSON String
  
  //Converting JSON String to JSON Objects
          JSONObject  json_data=pd.responseData(data);
          JSONObject  json_med=pd.responseData(med);
  //Was only trying to return the 1st table data but the code stopped working.
          return json_data;
       }
  
  
  }
  </code></pre>
  
  <p>I don't know the cause of the error .I have added external jars of hibernate but that also didn't work.
  Thanks in advance.</p>