关于idea中SpringBoot启动失败的坑
很多时候你新建了Maven 或者SpringBoot 工程,激动的点了主启动类,你就发现了下面的错误
Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message:
Error creating bean with name 'servletEndpointRegistrar' defined in class path resource
[org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$
WebMvcServletEndpointManagementContextConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]:
Factory method 'servletEndpointRegistrar' threw exception;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'healthEndpoint' defined in class path resource
[org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]:
Unsatisfied dependency expressed through method 'healthEndpoint' parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'healthContributorRegistry' defined in class path resource
[org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]:
Factory method 'healthContributorRegistry' threw exception;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration':
Unsatisfied dependency expressed through constructor parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]:
Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException:
Failed to determine a suitable driver class
[ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
--- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException:
Unable to start embedded Tomcat
--- [ restartedMain] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-09-03 13:12:04.338 ERROR 24572 --- [ restartedMain] 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).
这里说的是啥意思呢,你没有数据库相关的链接,数据库相关的链接在哪里配置呢,就是在你的Resource文件目录下的properties 或者yml文件中
但是这里你可能会说,我**不用数据库,我干啥配这个b玩意,我想说这句话的时候,你已经点了很多遍的主启动都报这个错误,
今天你算来对了,我敢肯定80%的人都遇到过这个问题。但是不知道为啥,今天我给你分析一下昂:
①:在IDEA 中用SpringInitial 点点点生成的SpringBoot/cloud项目
②:跟视频操作,一顿操作后发现不能启动,
③:DonwLoad下的代码 复制进去的POM依赖
还有很多昂,不墨迹了说重点吧。
解决方法:
首先着重看自己的POM依赖(是自己的POM,不是父工程,也不是其他工程,是自己的)中有无以下依赖
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
经过鄙人的测试,就是第一个依赖捣的鬼,这就是为啥你加了这个依赖你不配置相关的mysql链接,Spring就给你报错的原因。
最后提醒:按需注入POM才是正道,老铁们,我做的对么?
关于idea中SpringBoot启动失败的坑的更多相关文章
- springboot启动失败( No active profile set, falling back to default profiles: default)
问题: springboot启动失败( No active profile set, falling back to default profiles: default) 解决方法 在pom.xml文 ...
- APMServ中Apache启动失败的原因
APMServ中Apache启动失败绝大多数的情况是因为APMServ得路径出错和80端口被占用,也有可能您使用的是WIN8系统,下面SJY根据不同情况告诉大家如何解决APMServ中Apache启动 ...
- hadoop中namenode启动失败
jps发现namenode启动失败 每次开机都要重新格式化一下namenode才可以 其实问题出现自tmp文件上,因为每次开机就会被清空,所以现在我们配置一个tmp文件目录. 如果之前没有配置过,默认 ...
- SpringBoot 启动失败 Failed to determine a suitable driver class 问题解决方案
Description: Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no ...
- 微服务中springboot启动问题
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardS ...
- 微服务框架中springboot启动的一个问题
微服务中,采用的是springboot构建单个项目,其中一个项目user启动过程中总是启动补起来,相关的地方都没有错,始终启动不起来,而且要命的是控制台不打印日志,日志级别是debug级别的,但是打印 ...
- HDFS中namenode启动失败
1.环境配置: -1.core-site.xml文件 <configuration> <property> <name>fs.defaultFS</name& ...
- 解决springboot启动失败问题:Unable to start embedded container;
将一个springboot项目导入到eclipse后,启动时报错Unable to start embedded container,以下时全部错误信息: Application startup fa ...
- 在windows 2008 R2中SQl Server 2008中代理启动失败的一个原因总结
启动SQL代理的时候报错如下: 关调用实时(JIT)调试而不是此对话框的详细信息,请参见此消息的结尾. ************** 异常文本 **************System.NullRef ...
随机推荐
- day9.关于文件的操作
一.文件操作 """ fp = open("文件名",mode="模式",encoding="utf-8") ...
- this.getClass().getResource(String) 路径问题
this.getClass().getResource(String) 路径问题 这里的默认当前路径是该类所在目录: this.getClass() 说明了一切!! 找到类,就找文件:很显然和类 ...
- 8道python练习题,能做出来的没几个
变量的定义 程序就是用来处理数据的,而变量就是用来存储数据的 很多人学习python,不知道从何学起.很多人学习python,掌握了基本语法过后,不知道在哪里寻找案例上手.很多已经做案例的人,却不知道 ...
- C#LeetCode刷题之#521-最长特殊序列 Ⅰ(Longest Uncommon Subsequence I)
问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/3949 访问. 给定两个字符串,你需要从这两个字符串中找出最长的特 ...
- Vercel托管博客
背景 本站已托管至Vercel,但作为一名前端小白,昨天帮朋友托管博客到Vercel的过程中到处碰壁,就想写一篇博客记录一下. 注册登录 点击Vercel官网{% btn 'https://verce ...
- 调试备忘录-J-Link RTT的使用(原理 + 教程 + 应用 + 代码)
MCU:STM32F407VE MDK:5.29 IAR:8.32 目录--点击可快速直达 目录 写在前面 什么是RTT? RTT的工作原理 RTT的性能 快速使用教程 高级使用教程 附上测试代码 2 ...
- 学长小清新题表之UOJ 14.DZY Loves Graph
学长小清新题表之UOJ 14.DZY Loves Graph 题目描述 \(DZY\)开始有 \(n\) 个点,现在他对这 \(n\) 个点进行了 \(m\) 次操作,对于第 \(i\) 个操作(从 ...
- linux上传下载小工具lrzsz
工具压缩包链接 密码:zbef 1.将压缩包放到linux的任意目录下,执行:tar zxvf lrzsz-0.12.20.tar.gz 解压压缩包 2.cd lrzsz-0.12.20 3../co ...
- Jmeter 常用函数(21)- 详解 __char
如果你想查看更多 Jmeter 常用函数可以在这篇文章找找哦 https://www.cnblogs.com/poloyy/p/13291704.htm 作用 根据给定的字符值转换成 Unicode ...
- 为什么 max() 应该写成 b < a ? a : b 呢?
在 < C++ Templates 2nd Edition >Chapter 1 中,作者将 max() 模板定义如下: template <typename T> T max ...