Failed to determine a suitable driver class

Posted F_angT

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Failed to determine a suitable driver class相关的知识,希望对你有一定的参考价值。

先看错误

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

解决

网上有很多解决文章,比如:
完美解决Failed to determine a suitable driver class的问题

然而,我其实之前是可以,突然间不行了。查看了git的历史,最近也就在profile里改了个port,为什么会影响到数据库连接呢?

没有任何头绪,万能大法,重启电脑都用了,还是不行。

于是我把profile里面除了数据库配置,其他行全部删了,当然也包括这个server.port=9091

神奇了,数据库不报错了。当然因为删了其他配置,其他报错了。 然后慢慢把配置都贴回去,贴完,就好了 。。。。。

总结

个人猜想是当时改这个port,这行语句也行字符有问题啥的,引起了编译器的bug。就这样吧。。。

Springboot启动报错:Failed to determine a suitable driver class

Description:

Failed to configure a DataSource: \'url\' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

 

原因:

没有配置数据源,但springboot默认启用了数据源配置

解决办法:

启动类添加exclude参数,不启用DataSource

 

以上是关于Failed to determine a suitable driver class的主要内容,如果未能解决你的问题,请参考以下文章

SpringBoot启动异常:Reason: Failed to determine a suitable driver class

SpringBoot启动报错Failed to determine a suitable driver class

SpringBoot启动报错Failed to determine a suitable driver class

SpringBoot - Failed to determine a suitable driver class

Failed to determine a suitable driver class

Springboot启动报错:Failed to determine a suitable driver class