启动Tomcat时报错:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXX‘...
我这边的原因是zookeeper的地址填写错误导致
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<dubbo:protocol name="dubbo" port="20881"></dubbo:protocol>
<dubbo:application name="pinyougou-sellergoods-service"/>
<dubbo:registry address="zookeeper://192.168.25.131:2181"/>
<dubbo:annotation package="com.pinyougou.sellergoods.service.impl" />
</beans>
总结:
- 1、zookeeper地址填写错误
- 2、若使用虚拟机的话,虚拟机重启后IP地址可能会变,记得检查后将对应配置的地址进行修改