springboot+dubbo服务调用超时报错: com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method login

错误:

consumer端:

com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method login in the service cn.topcode.service.RpcUserService.

Caused by: com.alibaba.dubbo.remoting.TimeoutException: Waiting server-side response timeout.

provider端:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user ''@'localhost' to database

 

解决步骤:

1. 超时,当时怀疑配置问题,直接在consumer的配置文件中加上:

>dubbo.consumer.timeout=120000 

问题没解决:(

2. 百度一下说,可能是provider中有断点,(⊙o⊙)…,我真的有,于是去掉所有断点,检查了三遍,再次运行,

还是未解决:(

3. provider端报错解决:数据库权限问题,在数据库执行

grant all on 数据库.* to 'root'@'%' identified by '密码' with grant option;

未解决:(

4.最后发现配置文件中:

spring.datasource.data-username=root
spring.datasource.data-password=root
改成
spring.datasource.username=root
spring.datasource.password=root

问题解决了,原来是配置文件连接数据库配置未被读取到T o T,所以一直连接不了数据库

 

 

 

你可能感兴趣的:(项目开发中解决の问题)