报错解决:Reason: Failed to determine a suitable driver class

简介: 报错解决:Reason: Failed to determine a suitable driver class

背景:

导入别人的项目,却报错:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-05-06 23:35:15.267 ERROR 12944 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
***************************
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).
Process finished with exit code 1



这是一个常见的问题,如果试了很多都不行,可能是这个原因,以下是没解决前截图:


image.png


注意看:

1、 resources 其实只是一个普通的文件夹而已

2、配置文件里, spring.datasource.url 是灰色的,而 spring.datasource.password 却是有颜色的


解决步骤:右击 resources 文件夹,然后选择 Mark Directory as ,然后选择 Resources Root 即可:


image.png


修改好之后:


image.png


这样就不会报错了!


其他参考文章:

https://blog.csdn.net/ht_kasi/article/details/82259860?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-82259860-blog-118083303.pc_relevant_antiscanv2&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-82259860-blog-118083303.pc_relevant_antiscanv2&utm_relevant_index=1


相关文章
|
6天前
|
安全 Java 应用服务中间件
A configuration error occurred during startup.Please verify the preference field with the prompt: To
A configuration error occurred during startup.Please verify the preference field with the prompt: To
17 0
|
9月前
|
虚拟化
成功解决Failed to execute stage ‘Setup validation’: Hardware does not support virtualization.
成功解决Failed to execute stage ‘Setup validation’: Hardware does not support virtualization.
|
7月前
|
Java 数据库连接 数据库
【Java异常】Failed to determine a suitable driver class
【Java异常】Failed to determine a suitable driver class
194 0
|
9月前
|
开发工具
WARNING: library configuration mismatch
WARNING: library configuration mismatch
203 0
|
Java 应用服务中间件
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
|
并行计算 PyTorch 算法框架/工具
CUDA unknown error - this may be due to an incorrectly set up environment 问题解决
CUDA unknown error - this may be due to an incorrectly set up environment 问题解决
CUDA unknown error - this may be due to an incorrectly set up environment 问题解决
|
应用服务中间件 Android开发
a configuration error occurred during startup. place verify the preference field whth the prompt:TomcatJDK name:
a configuration error occurred during startup. place verify the preference field whth the prompt:TomcatJDK name:
107 0
a configuration error occurred during startup. place verify the preference field whth the prompt:TomcatJDK name:
|
Go iOS开发
The operation couldn’t be completed. Unable to log in with account 'myappleid'. An unexpected failure occurred while logging in (Underlying error code 1100).解决方法
The operation couldn’t be completed. Unable to log in with account 'myappleid'. An unexpected failure occurred while logging in (Underlying error code 1100).解决方法
363 0
|
Java 应用服务中间件 Maven
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean解决方案N种
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean解决方案N种
315 0
OPA 11 - how is check called in my iClickTheCreateButton
Created by Wang, Jerry, last modified on Nov 08, 2015
126 0
OPA 11 - how is check called in my iClickTheCreateButton