parkt90 / dis-seckill

⭐⭐⭐⭐SpringBoot+Zookeeper+Dubbo打造分布式高并发商品秒杀系统
MIT License
206 stars 44 forks source link

我在windows下按序启动,前五个没问题,最后启动网关报错 #2

Open clcshr opened 2 years ago

clcshr commented 2 years ago

请问这是啥原因呢?seckillController无法注入? ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'seckillController' defined in file [D:\dis-seckill-master\dis-seckill-master\dis-seckill-gateway\target\classes\com\seckill\dis\gateway\seckill\SeckillController.class]: Invocation of init method failed; nested exception is org.apache.dubbo.rpc.RpcException: Failed to invoke the method listGoodsVo in the service com.seckill.dis.common.api.goods.GoodsServiceApi. Tried 3 times of the providers [180.201.4.191:12346] (1/2) from the registry 127.0.0.1:2181 on the consumer 180.201.4.191 using the dubbo version 2.7.1.

parkt90 commented 2 years ago

从报错信息上来看,是dis-seckill-goods模块下GoodsServiceApi接口listGoodsVo方法调用的问题。建议查看数据是否能够正常连接和使用

geek-LHW commented 2 years ago

我已经解决了这个问题,你可以看一下他数据库的配置(在项目的application.properties文件里),你会发现他的用户名是root,密码是1 …… 所以问题很简单了,你把你的用户名和密码改成这个就行了; 如果你看了他的README.MD文件,里面有写到密码是123,如果你改成了123,那么很显然,会访问不了数据库,自然就超时报错了…

请问这是啥原因呢?seckillController无法注入? ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'seckillController' defined in file [D:\dis-seckill-master\dis-seckill-master\dis-seckill-gateway\target\classes\com\seckill\dis\gateway\seckill\SeckillController.class]: Invocation of init method failed; nested exception is org.apache.dubbo.rpc.RpcException: Failed to invoke the method listGoodsVo in the service com.seckill.dis.common.api.goods.GoodsServiceApi. Tried 3 times of the providers [180.201.4.191:12346] (1/2) from the registry 127.0.0.1:2181 on the consumer 180.201.4.191 using the dubbo version 2.7.1.