Nacos服务配置与虚拟机数据库连接

10 篇文章 0 订阅
9 篇文章 0 订阅

1、Application启动异常

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 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).

2、解决方式——Nacos页面新建命名空间

Maven配置类——命名空间名

在这里插入图片描述

在Nacos新建命名空间——命名与Maven项目配置文件一致

在这里插入图片描述
在这里插入图片描述

3、数据库连接异常

在这里插入图片描述

create connection SQLException, url: jdbc:mysql://localhost:3306/pd_sms?serverTimezone=CTT&characterEncoding=utf8&useUnicode=true&useSSL=false&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true, errorCode 0, state 08001 

4、解决方式——在Nacos配置区修改数据库配置文件

需先配置好命名空间才能进行这一步
在这里插入图片描述
在这里插入图片描述

修改IP地址到虚拟机IP

之所以如此是因为本地MySQL版本过低——别骂,就想试试虚拟机数据库
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

5、端口占用问题及解决

在这里插入图片描述

netty服务启动异常-Address already in use: bind
# 根据报错信息查找文件
[com.itherima.sms.netty.NettyServer.start:63]

在这里插入图片描述

6、Nacos注册问题——尚未解决,但不影响功能

在这里插入图片描述

nacos registry, pd-sms-api register failed...NacosRegistration{nacosDiscoveryProperties=NacosDiscoveryProperties{serverAddr='127.0.0.1:8848', endpoint='', namespace='pinda-sms', watchDelay=30000, logName='', service='pd-sms-api', weight=1.0, clusterName='DEFAULT', group='DEFAULT_GROUP', namingLoadCacheAtStart='false', metadata={preserved.register.source=SPRING_CLOUD, management.endpoints.web.base-path=/actuator, management.context-path=/actuator}, registerEnabled=true, ip='192.168.220.1', networkInterface='', port=8771, secure=false, accessKey='', secretKey='', heartBeatInterval=null, heartBeatTimeout=null, ipDeleteTimeout=null}}, 
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值