title: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.3.RELEASE:run
body: <p>I'm a newbie in java spring and hibernate. i use maven to manage my project, i can not understand what problem i have. It's very strange. I has stucked here for a week.
  This is full error</p>
  
  <pre><code>[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.3.RELEASE:run (default-cli) on project demo: An exception occurred while running. null: InvocationTargetException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). -&gt; [Help 1]
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
  </code></pre>
  
  <p>This is my project tree:
  <a href="https://i.stack.imgur.com/4Fy7m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Fy7m.png" alt="project tree"></a>
  Config.java file:</p>
  
  <pre><code>package com.config;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import com.dao.DepartmentDAO;
  import com.daoimpl.DepartmentDAOImpl;
  
  
  @Configuration
  public class Config {
  
      @Bean
      public DepartmentDAO departmentDAO(){
      //      DepartmentDAOImpl departmentDaoImpl = new DepartmentDAOImpl();
              return new DepartmentDAOImpl();
      }
  }
  </code></pre>
  
  <p>pom.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  </code></pre>
  
  <p>
      <a href="http://maven.apache.org/xsd/maven-4.0.0.xsd" rel="nofollow noreferrer">http://maven.apache.org/xsd/maven-4.0.0.xsd</a>">
      4.0.0</p>
  
  <pre><code>&lt;groupId&gt;test.component&lt;/groupId&gt;
  &lt;artifactId&gt;demo&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
  &lt;name&gt;DemoHibernate&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.3.3.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;java.version&gt;1.8&lt;/java.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&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.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;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;3.6.3.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
          &lt;artifactId&gt;jta&lt;/artifactId&gt;
          &lt;version&gt;1.1&lt;/version&gt;
      &lt;/dependency&gt;
              &lt;dependency&gt;
           &lt;groupId&gt;org.eclipse.persistence&lt;/groupId&gt;
           &lt;artifactId&gt;eclipselink&lt;/artifactId&gt;
           &lt;version&gt;2.5.1&lt;/version&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.0.0&lt;/version&gt;
           &lt;scope&gt;compile&lt;/scope&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;5.1.36&lt;/version&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;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-tomcat&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;com.h2database&lt;/groupId&gt;
           &lt;artifactId&gt;h2&lt;/artifactId&gt;
           &lt;version&gt;1.3.156&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.hsqldb&lt;/groupId&gt;
         &lt;artifactId&gt;hsqldb&lt;/artifactId&gt;
         &lt;scope&gt;runtime&lt;/scope&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;
  </code></pre>
  
  <p></p>
  
  <p>MainController.java</p>
  
  <pre><code>package com.controller;
  
  import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired;
  //import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RestController;
  
  import com.dao.DepartmentDAO;
  import com.entities.Department;
  
  //@Controller
  @RestController
  public class MainController {
      @Autowired
      private DepartmentDAO departmentDAO;
  
      @RequestMapping({"/","/home","/index"})
      public String home(){
      return "index";
  }
  
  @RequestMapping({"/deptList"})
   public String deptList() {
       departmentDAO.createDepartment("Dept Name", "Dept Location");
  
       List&lt;Department&gt; list = departmentDAO.listDepartment();
       for (Department dept : list) {
           System.out.println("Dept No " + dept.getDeptNo());
       }
       //      model.addAttribute("departments", list);
       return "deptList";
   }
  }
  </code></pre>
  
  <p>DepartmentDAO.java</p>
  
  <pre><code>package com.dao;
  
  import java.util.List;
  //import org.springframework.stereotype.Component;
  //import org.springframework.stereotype.Repository;
  
  import com.entities.*;
  
  //@Repository
  //@Component
  public interface DepartmentDAO {
      public List&lt;Department&gt; listDepartment() ;
      public Integer getMaxDeptId();
      public void createDepartment(String name,String location);  
  }
  </code></pre>
  
  <p>DepartmentDAOImpl.java</p>
  
  <pre><code>package com.daoimpl;
  
  import java.util.List;
  
  import org.hibernate.Query;
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.springframework.transaction.annotation.Transactional;
  
  import com.dao.DepartmentDAO;
  import com.entities.Department;
  
  
  @Transactional
  public class DepartmentDAOImpl implements DepartmentDAO{
  
  private SessionFactory sessionFactory;
  
  public void setSessionFactory(SessionFactory sessionFactory) {
      this.sessionFactory = sessionFactory;
  }
  
  @SuppressWarnings("unchecked")
  @Override
  public List&lt;Department&gt; listDepartment() {
      Session session = this.sessionFactory.getCurrentSession();
      List&lt;Department&gt; list = session.createQuery("from Department").list();
      return list;
  }
  
  @Override
  public Integer getMaxDeptId() {
      Session session = this.sessionFactory.getCurrentSession();
      String sql = "Select max(d.deptId) from Department d";
      Query query = session.createQuery(sql);
      Integer maxDeptId = (Integer)query.uniqueResult();
      if (maxDeptId == null){
          return 0;
      }
      return maxDeptId;
  }
  
  @Override
  public void createDepartment(String name, String location) {
      Integer deptId = getMaxDeptId() + 1;
      Department dept = new Department();
      dept.setDeptId(deptId);
      dept.setDeptNo("D" + deptId);
      dept.setDeptName(name);
      dept.setLocation(location);
      Session session = this.sessionFactory.getCurrentSession();
      session.persist(dept);
  }
  
  }
  </code></pre>
  
  <p>Department.java</p>
  
  <pre><code>package com.entities;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.Table;
  import javax.persistence.UniqueConstraint;
  
  
  @Entity
  @Table(name = "DEPARTMENT", uniqueConstraints = {
  @UniqueConstraint(columnNames = { "DEPT_NO" }) })
  public class Department {
  private int deptId;
  private String deptNo;
  private String deptName;
  private String location;
  
  public Department(){
  
  }
  
  public Department(Integer deptId, String deptName, String location){ 
      this.deptId = deptId;
      this.deptNo = "D" + this.deptId;
      this.deptName = deptName;
      this.location = location;
  }
  
  @Id
  @Column(name = "DEPT_ID")
  public int getDeptId() {
      return deptId;
  }
  
  public void setDeptId(int deptId) {
      this.deptId = deptId;
  }
  
  @Column(name = "DEPT_NO", length = 20, nullable = false)
  public String getDeptNo() {
      return deptNo;
  }
  
  public void setDeptNo(String deptNo) {
      this.deptNo = deptNo;
  }
  
  @Column(name = "DEPT_NAME", nullable = false)
  public String getDeptName() {
      return deptName;
  }
  
  public void setDeptName(String deptName) {
      this.deptName = deptName;
  }
  
  @Column(name = "LOCATION")
  public String getLocation() {
      return location;
  }
  
  public void setLocation(String location) {
      this.location = location;
  }   
  
  
  }
  </code></pre>
  
  <p>Department.hbm.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt;
  &lt;!-- Generated Apr 12, 2016 12:33:11 AM by Hibernate Tools 3.5.0.Final --&gt;
  &lt;hibernate-mapping&gt;
      &lt;class name="com.entities.Department" table="DEPARTMENT"&gt;
      &lt;id name="deptId" type="int"&gt;
          &lt;column name="DEPTID" /&gt;
          &lt;generator class="assigned" /&gt;
      &lt;/id&gt;
      &lt;property name="deptNo" type="java.lang.String"&gt;
          &lt;column name="DEPTNO" /&gt;
      &lt;/property&gt;
      &lt;property name="deptName" type="java.lang.String"&gt;
          &lt;column name="DEPTNAME" /&gt;
      &lt;/property&gt;
      &lt;property name="location" type="java.lang.String"&gt;
          &lt;column name="LOCATION" /&gt;
      &lt;/property&gt;
  &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>hibernate.cfg.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
  &lt;session-factory&gt;
      &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
      &lt;property name="hibernate.connection.password"&gt;ruoitrau95&lt;/property&gt;
      &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/testdkt&lt;/property&gt;
      &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt;
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/property&gt;
  &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>Sorry if this is a stupid question, i'm a newbie and i can not fix it for a week. Thanks for every support. :)</p>