As mentioned in the headline of question I am facing issue Cannot determine embedded database driver class for database type NONE. The application I have built is on spring boot and working fine when I run the code in intellij.
I have followed several questions regarding the same exception and they suggested that I need to add spring.datasource properties in my application.properties file. I already have them and still facing the same issue. This issue occurs when I create jar file using artifacts of intellij and then run it by the following command.
java – jar myJar.jar
My application.properties file
# =============================== # = DATA SOURCE # =============================== spring.datasource.url = jdbc:mysql://localhost:3306/db_wssmith?useSSL=false spring.datasource.username = spring.datasource.password = spring.datasource.driver-class-name=com.mysql.jdbc.Driver
Error Log while running jar
ERROR org.springframework.boot.SpringApplication – Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration’: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource’ defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.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).
Use maven command instead of using intellij.