Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 37|回复: 0

zookeeper dubbo 问题解决录

[复制链接]
  • TA的每日心情
    奋斗
    昨天 21:54
  • 签到天数: 95 天

    [LV.6]常住居民II

    1378

    主题

    1435

    帖子

    5万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    50644
    发表于 2021-6-13 15:42:47 | 显示全部楼层 |阅读模式

    问题1:

    运行起来不报错,不过在Console没有zookeeper的心跳信息,也就是说没有配置上zookeeper,而出错的原因是下面蓝色这段解析不了

    spring-dubbo-provider.xml

    <?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:dubbo="http://code.alibabatech.com/schema/dubbo"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://code.alibabatech.com/schema/dubbo
    http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
    <!-- 提供方应用信息,用于计算依赖 -->
    <dubbo:application name="dubbo-service" />
    <!-- 使用zookeeper注册中心暴露服务地址:部署zookeeper控制台的电脑ip -->
    <dubbo:registry address="zookeeper://127.0.0.1:2181" />
    <!-- 用dubbo协议在20880端口暴露服务 host="192.168.3.53" -->
    <dubbo:protocol name="dubbo" host="192.168.3.53" port="20883" />
    <!-- 声明需要暴露的服务接口,对应的具体实现类是自定义bean -->
    <dubbo:service interface="com.zk1.service.IUserService"
    ref="userService" />
    <!-- 服务实现 -->
    <bean id="userService" class="com.zk1.service.impl.UserServiceImpl" />

    </beans>

    解决方法:

    把 dubbo-2.5.3.jar解压,把解压出来的dubbo.xsd 随便你放一个地方,打开eclipse--》Preferences--》XML--》XML Catalog --》add --》File System 把刚才dubbo.xsd弄进来,再改一下Location下面的Keyhttp://code.alibabatech.com/schema/dubbo 改为 http://code.alibabatech.com/schema/dubbo/dubbo.xsd 然后保存


     

     

     

     

    问题2:

    2016-12-19 20:20:21 AbstractConfig:301 WARN - [DUBBO] keefer: keefer: unknown error, dubbo version: 2.5.3, current host: 127.0.0.1
    java.net.UnknownHostException: keefer: keefer: unknown error
    at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
    at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:299)
    at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:281)
    at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:242)
    at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:143)
    at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:109)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:855)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

    解决方法:

    在 spring-dubbo-provider.xml 文件里边

    <dubbo:protocol name="dubbo" port="20883" />改成下面这个,加上host地址(记着,本人用127.0.0.1测试无效)

    <dubbo:protocol name="dubbo" host="192.168.3.53" port="20883" />

     

     

     

    问题3:

    严重: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener
    java.lang.IllegalStateException: Web app root system property already set to different value: 'webapp.root' = [/home/keefer/JAVA/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/zk1service/] instead of [/home/keefer/JAVA/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/zk1client/] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
    at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:161)
    at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:119)
    at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:49)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

    解决方法:

    将web.xml文件里边的spring监听器

    <listener>
    <description>spring监听器</description>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>

    修改成

    <listener>
    <description>spring监听器</description>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    dubbo消费者这端不用log4j日志配置,去掉就好

     

    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2021-8-3 07:59 , Processed in 0.060503 second(s), 29 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表