报错解决: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


相关文章
|
Java
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
1127 0
Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
|
7月前
An unexpected error was encountered while executing a WSL command. Common causes include access righ
An unexpected error was encountered while executing a WSL command. Common causes include access righ
|
Java Maven Android开发
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
成功解决FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE
|
7月前
|
安全 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
|
Java 数据库连接 数据库
【Java异常】Failed to determine a suitable driver class
【Java异常】Failed to determine a suitable driver class
448 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.
Gradle sync failed: Unsupported method: NativeArtifact.getSourceFolders().
Gradle sync failed: Unsupported method: NativeArtifact.getSourceFolders().
101 0
|
并行计算 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:
141 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).解决方法
470 0