Solve problems encountered in Spring-boot startup: Cannot determine embedded database driver class for database type NONE

Source: Internet
Author: User

The problem is as follows:

2017-07-16 08:50:57.436 INFO 13524---[main] c.p.p.web.pointshopwebapplication:starting Pointshopweb Application on MSI with PID 13524 (D:\javaProject\com.ppdai.pointshop\pointshop-web\target\classes started by Yangliweng in D:\javaProject\com.ppdai.pointshop)

2017-07-16 08:50:57.436 INFO 13524---[main] c.p.p.web.pointshopwebapplication:no active profile set , falling back to default Profiles:default

2017-07-16 08:50:57.478 INFO 13524---[main] s.c.a.annotationconfigapplicationcontext:refreshing org.spring [Email protected]179bb86:startup date [Sun Jul 08:50:57 gmt+08:00 2017]; Root of context Hierarchy

2017-07-16 08:50:57.798 WARN 13524---[main] o.m.s.mapper.classpathmapperscanner:no MyBatis mapper was Found in ' [Com.ppdai.pointshop.web.controller, Com.ppdai.pointshop.web] ' package. Please check your configuration.

2017-07-16 08:50:57.829 INFO 13524---[main]. s.d.r.c.repositoryconfigurationdelegate:multiple Spring Data Modules found, entering strict repository configuration mode!

2017-07-16 08:50:58.001 WARN 13524---[main] o.h.v.m.parametermessageinterpolator:hv000184:parameterme Ssageinterpolator has been chosen, EL interpolation would not be supported

2017-07-16 08:50:58.151 WARN 13524---[main] o.h.v.m.parametermessageinterpolator:hv000184:parameterme Ssageinterpolator has been chosen, EL interpolation would not be supported

2017-07-16 08:50:58.224  warn 13524---[          main] S.c.a.annotationconfigapplicationc Ontext:exception encountered during context initialization-cancelling refresh Attempt:org.springframework.beans.fact Ory. 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 a embedded database, put a supported one on the classpath. If you have the database settings to is loaded from a particular profiles you maY need to active it (no profiles is currently active).

2017-07-16 08:50:58.240 INFO 13524---[main] utoconfigurationreportlogginginitializer:

Error starting ApplicationContext. To display the Auto-configuration report re-run your application with ' debug ' enabled.

2017-07-16 08:50:58.240 ERROR 13524---[main] o.s.b.d.loggingfailureanalysisreporter:

***************************

Application FAILED to START

***************************

Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want a embedded database, put a supported one on the classpath. If you have the database settings to is loaded from a particular profiles you may need to active it (no profiles is currently Active).

Process finished with exit code 1

------------------------I'm a split line------------------

Find the so-called solution on the Web:

@SpringBootApplication (exclude = {datasourceautoconfiguration.class, hibernatejpaautoconfiguration.class}, Scanbasepackages = {"Com.ppdai.pointshop.web.controller"}) public class Pointshopwebapplication {public static void Main (string[] args) {Springapplication.run (pointshopwebapplication.class, args);}}

But unfortunately, it's useless.

So with maven download good springboot source code, and then debugging breakpoints in, see what is the situation, and finally found the problem lies:

Because I'm a new project and I don't have a data source configured, but I want to start the project without configuring the data source, what should I do? The method found on the Internet is not valid, so I made a bold guess: it must be a place to load the bean, because this is a new project, so I think it is very possible to start loading, and start loading only the Pom file within the dependencies can be done. Here is my dependency dependency:

<dependencies><!--https://mvnrepository.com/artifact/org.springframework.boot/ Spring-boot-autoconfigure--><dependency><groupid>org.springframework.boot</groupid>< artifactid>spring-boot-autoconfigure</artifactid><version>1.5.4.release</version></ dependency><!--Https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-->< dependency><groupid>org.springframework.boot</groupid><artifactid>spring-boot</ Artifactid><version>1.5.4.release</version></dependency><dependency><groupid> org.springframework.boot</groupid><artifactid>spring-boot-starter-aop</artifactid>< Version>1.5.4.release</version></dependency><dependency><groupid> Org.springframework.boot</groupid><artifactid>spring-boot-starter-data-redis</artifactid> <version>1.5.4.release</version></dependency><dependency><groupid>org.mybatis.spring.boot</groupid><artifactid>mybatis-spring-boot-starter</ Artifactid><version>1.3.0</version></dependency><dependency><groupid> org.springframework.boot</groupid><artifactid>spring-boot-starter-web</artifactid>< Version>1.5.4.release</version></dependency><dependency><groupid> org.springframework.boot</groupid><artifactid>spring-boot-starter-tomcat</artifactid>< Version>1.5.4.release</version><scope>provided</scope></dependency><dependency ><groupid>org.springframework.boot</groupid><artifactid>spring-boot-starter-test</ Artifactid><version>1.5.4.release</version><scope>test</scope></dependency> <!--Https://mvnrepository.com/artifact/org.springframework/spring-core--><dependency><groupid >org.springframework</groupid><artifactid>spring-core</artifactid><version>4.3.9.release</version></dependency><!--https:/ /mvnrepository.com/artifact/org.springframework/spring-context--><dependency><groupid> org.springframework</groupid><artifactid>spring-context</artifactid><version>4.3.9. Release</version></dependency></dependencies>

A check, and finally found org.mybatis.spring.boot this dependency, comments out can be found, debugging time Beannames obviously a lot less.

<dependency>   <groupId>org.mybatis.spring.boot</groupId>   <artifactId> Mybatis-spring-boot-starter</artifactid>   <version>1.3.0</version></dependency>

Finally, Spring boot is successful!

Solve problems encountered in Spring-boot startup: Cannot determine embedded database driver class for database type NONE

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.