初学Dubbo与spring结合,使用com.alibaba.dubbo.config.annotation.Service 注解时报错Error creating bean with name...

本文记录了一次在使用Dubbo框架进行服务注册时遇到的问题,主要原因是Zookeeper未能成功连接,进一步排查发现是因为Linux防火墙未关闭导致。通过关闭防火墙解决了Zookeeper的连接问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

// A code block
// An highlighted block
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'helloServiceImpl' defined in file [D:\IdeaProjects\doubbodemo_provider\target\classes\com\itheima\service\impl\HelloServiceImpl.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Failed to register dubbo://192.168.119.1:20881/com.itheima.service.HelloService?anyhost=true&application=dubbodemo_provider&dubbo=2.6.0&generic=false&interface=com.itheima.service.HelloService&methods=sayHello&pid=15852&side=provider&timestamp=1602402652822 to registry 192.168.119.128:2181, cause: Failed to register dubbo://192.168.119.1:20881/com.itheima.service.HelloService?anyhost=true&application=dubbodemo_provider&dubbo=2.6.0&generic=false&interface=com.itheima.service.HelloService&methods=sayHello&pid=15852&side=provider&timestamp=1602402652822 to zookeeper zookeeper://192.168.119.128:2181/com.alibaba.dubbo.registry.RegistryService?application=dubbodemo_provider&dubbo=2.6.0&interface=com.alibaba.dubbo.registry.RegistryService&pid=15852&timestamp=1602402652804, cause: Zookeeper is not connected yet!
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:587)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)

解决: 我的Zookeeper是部署在 linux 系统 ,因linux防火墙未关闭, Zookeeper连接失败报错, cause 字样后面的提示真的很重要.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值