前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >spring cloud(学习笔记)微服务启动错误(1)

spring cloud(学习笔记)微服务启动错误(1)

作者头像
Dawnzhang
发布2018-10-18 14:39:34
7690
发布2018-10-18 14:39:34
举报

今天下午在启动spring cloud微服务的时候,报了这个错误:

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2018-07-03 20:17:10.295 ERROR 19024 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :

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

Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).

Disconnected from the target VM, address: '127.0.0.1:55393', transport: 'socket'

Process finished with exit code 1

刚开始我以为是端口被占用。果断cmd并输入netstat -aon,找半天没发现占用的端口,然后又网上看了一下,

转自:https://blog.csdn.net/Loser100/article/details/78190703?locationNum=9&fps=1

SpringBoot启动报错:Cannot determine embedded database driver class for database type NONE

springboot启动时会自动注入数据源和配置jpa

解决办法一:

启动类中加入注解:@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})

解决方法二:

在Application.properties文件内配置数据源即可。代码如下:

spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5

我仔细的检查了一下,也加了注解,试了一下,我靠,没用啊,人生呐,真是改不完的bedug,

只好用出终极大招,拷贝我自己的代码,删除项目,从新从svn更新项目,导入运行,哎呦我去。怎么还是这问题?难道是我项目配置问题?不对啊,我其他的项目都没有问题啊。束手无策,只好求助小碗(一个认真工作的大佬);

通过反复调试,终于找到了。问题所在,pom.xml里面有一个错误的配置,

       <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

删了就可以运行,微服务也可以注册。配置文件请大家仔细检查。配置文件不对,什么都是扯淡。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018-07-03 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 解决办法一:
  • 解决方法二:
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档