title: Error creating bean with name 'entityManagerFactory' not fixed by javaxb or hibernate dependencies
body: <p>I realize this has been asked time and time again here but after trying the fixes from multiple responses I am still running into this problem.</p>
  
  <p>I'm receiving an error when I try to run my spring API stating:</p>
  
  <pre><code>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: javax/xml/bind/JAXBException
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
      at com.max.rocketLeagueAPI.Main.main(Main.java:11) ~[classes/:na]
  Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
      at org.hibernate.boot.spi.XmlMappingBinderAccess.&lt;init&gt;(XmlMappingBinderAccess.java:43) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
      at org.hibernate.boot.MetadataSources.&lt;init&gt;(MetadataSources.java:87) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.&lt;init&gt;(EntityManagerFactoryBuilderImpl.java:179) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.&lt;init&gt;(EntityManagerFactoryBuilderImpl.java:149) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
      at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:54) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:360) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:382) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:371) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:336) ~[spring-orm-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
      ... 16 common frames omitted
  Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
      at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) ~[na:na]
      at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
      ... 27 common frames omitted
  
  
  Process finished with exit code 1
  </code></pre>
  
  <p>Here is my pom file. I have tried adding jaxb-api, hibernate-entitymanager, hibernate-core, and combinations of the three without any luck.</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.max&lt;/groupId&gt;
      &lt;artifactId&gt;rocketLeagueAPI&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&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.9.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;dependencies&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;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;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;/dependency&gt;
  &lt;!--        &lt;dependency&gt;--&gt;
  &lt;!--            &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;--&gt;
  &lt;!--            &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;--&gt;
  &lt;!--            &lt;version&gt;2.3.1&lt;/version&gt;--&gt;
  &lt;!--        &lt;/dependency&gt;--&gt;
      &lt;/dependencies&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&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>This is my model class:</p>
  
  <pre><code>package com.max.rocketLeagueAPI.Models;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  import java.sql.Timestamp;
  
  @Entity
  @Table(name = "cars")
  public class Car {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      @Column(name = "car_id")
      private int id;
      private String name;
      private String rarity;
      private String platform;
      @Column(name = "img_url")
      private String imgUrl;
      private boolean free;
      @Column(name = "updated_at")
      private Timestamp updatedAt;
  
      public Car() {}
  
      public int getId() {
          return this.id;
      }
  
      public String getName() {
          return this.name;
      }
  
      public String getRarity() {
          return this.rarity;
      }
  
      public String getPlatform() {
          return this.platform;
      }
  
      public String getImgUrl() {
          return this.imgUrl;
      }
  
      public boolean isFree() {
          return this.free;
      }
  
      public Timestamp getUpdatedAt() {
          return this.updatedAt;
      }
  }
  </code></pre>
  
  <p>Here is the table I am connecting to (or trying to)</p>
  
  <pre><code>mysql&gt; describe cars;
  +------------+--------------+------+-----+-------------------+-----------------------------+
  | Field      | Type         | Null | Key | Default           | Extra                       |
  +------------+--------------+------+-----+-------------------+-----------------------------+
  | car_id     | int(11)      | NO   | PRI | NULL              | auto_increment              |
  | name       | varchar(30)  | NO   |     | NULL              |                             |
  | rarity     | varchar(15)  | YES  |     | NULL              |                             |
  | platform   | varchar(15)  | YES  |     | NULL              |                             |
  | img_url    | varchar(255) | YES  |     | NULL              |                             |
  | free       | tinyint(1)   | YES  |     | 1                 |                             |
  | updated_at | timestamp    | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
  +------------+--------------+------+-----+-------------------+-----------------------------+
  7 rows in set (0.00 sec)
  </code></pre>
  
  <p>And my interface:</p>
  
  <pre><code>package com.max.rocketLeagueAPI.Repositories;
  
  import com.max.rocketLeagueAPI.Models.Car;
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.stereotype.Repository;
  
  import java.util.List;
  
  @Repository
  public interface CarRepository extends JpaRepository&lt;Car, Integer&gt; {
      // car filters
      List&lt;Car&gt; findByPlatform(String platform);
      List&lt;Car&gt; findByRarity(String rarity);
      List&lt;Car&gt; findByFree(boolean isFree);
      List&lt;Car&gt; findByRarityAndFree(String rarity, boolean isFree);
  }
  </code></pre>
  
  <p>and my application.properties:</p>
  
  <pre><code>spring.datasource.url=jdbc:mysql://localhost:3306/rocketLeagueAPI
  spring.datasource.username=max
  spring.datasource.password=root
  spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  spring.jpa.hibernate.ddl-auto=update
  </code></pre>
  
  <p>I'm following a guide on writing a spring api but even when I use the exact code from the guide I get the same error. Is anything missing from what I have or annotated incorrectly?</p>