org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userControll

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userController’

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.cyj.service.UserService com.cyj.web.controller.UserController.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userService’: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.cyj.service.UserService. No provider available for the service com.cyj.service.UserService from the url zookeeper://192.168.41.144:2181/com.alibaba.dubbo.registry.RegistryService?application=myconsumer&dubbo=2.5.4&interface=com.cyj.service.UserService&methods=userLogin&pid=30860&revision=1.0-SNAPSHOT&side=consumer×tamp=1571022093812 to the consumer 192.168.245.1 use dubbo version 2.5.4

在服务Provider启动成功,且服务也发布成功情况下。访问消费者进入了登陆界面点击需要控制层操作时出现如上错误。

解决:
数据库问题,我的idea里面连接数据库写的是
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.41.144:3306/maven?characterEncoding=utf-8
jdbc.username=root
jdbc.password=root

因为本地数据库名字为localhost;
且因为该项目用到了dubbo,开启了集群,当初装liunx的时候安装的mysql是开机自动启动的,所以代码里写了虚拟机的IP,所以就连接上了虚拟机的而不是本地的。最重要的是虚拟机里的mysql没有maven我要链接的这个数据库。改成
jdbc.url=jdbc:mysql://localhost:3306/maven?characterEncoding=utf-8
就可以了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值