If you want an embedded database (H2, HSQL or Derby), please put it on the classpath. 配置了数据源仍然报异常的解决
异常信息:
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).
这里我是在 application.yml 配置了数据源的,但启动时仍然报这个异常。 检查了很多地方都没用。
解决方案:
将 pom.xml 中的 <packaging>pom</packaging>,改为<packaging>jar</packaging>
两者区别:
<packaging>pom</packaging>一般用于父子工程或者聚合项目中
那么这个pom.xml文件就是用来做jar包的版本控。
所以说如果是父子工程或者聚合项目,那么必须指明这个工程的打包方式为pom。
子项目或单体项目中应为 <packaging>jar</packaging> 或者 <packaging>war</packaging> ,如果不指定,则默认为<packaging>jar</packaging>。
至此解决。
DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐


所有评论(0)