出现错误的原因是消费端war没有启动成功, 但是zkClient和Dubbo的对应Thread启动了, web container无法加载对应的类,

INFO: Initializing ProtocolHandler ["http-bio-8081"]
Jun , :: PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8010"]
Jun , :: PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in ms
Jun , :: PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun , :: PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.
Jun , :: PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /home/tomcat/tomcat7_jdk7_2/webapps/daemon.war
Jun , :: PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Jun , :: PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Jun , :: PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/daemon] startup failed due to previous errors
Jun , :: PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
SEVERE: The web application [/daemon] appears to have started a thread named [DubboRegistryFailedRetryTimer-thread-] but has failed to stop it. This is very likely to create a memory leak.
Jun , :: PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads

然后在接下来的日志中

INFO: Starting ProtocolHandler ["http-bio-8081"]
Jun , :: PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8010"]
Jun , :: PM org.apache.catalina.startup.Catalina start
INFO: Server startup in ms
Jun , :: PM org.apache.catalina.loader.WebappClassLoaderBase loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load org.apache.zookeeper.proto.WatcherEvent. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:)

而Dubbo消费端未启动的原因, 是Spring初始化失败

 ::29.725 INFO      org.springframework.web.context.ContextLoader# Root WebApplicationContext: initialization started
::29.867 INFO ework.web.context.support.XmlWebApplicationContext# Refreshing Root WebApplicationContext: startup date [Wed Jun :: CST ]; root of context hierarchy
::29.917 INFO ramework.beans.factory.xml.XmlBeanDefinitionReader# Loading XML bean definitions from class path resource [spring/spring-daemon.xml]
::30.232 INFO ramework.beans.factory.xml.XmlBeanDefinitionReader# Loading XML bean definitions from class path resource [spring/spring-daemon-dubbo.xml]
::30.316 INFO com.alibaba.dubbo.common.logger.LoggerFactory# using logger: com.alibaba.dubbo.common.logger.log4j.Log4jLoggerAdapter
::30.561 INFO beans.factory.config.PropertyPlaceholderConfigurer# Loading properties file from class path resource [application.properties]
::30.634 INFO work.scheduling.concurrent.ThreadPoolTaskScheduler# Initializing ExecutorService 'myScheduler'
::30.634 INFO essorRegistrationDelegate$BeanPostProcessorChecker# Bean 'myScheduler' of type [class org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
::30.661 INFO gframework.cache.ehcache.EhCacheManagerFactoryBean# Initializing EhCache CacheManager
::30.664 DEBUG net.sf.ehcache.config.ConfigurationFactory# Configuring ehcache from InputStream
::30.677 DEBUG net.sf.ehcache.config.DiskStoreConfiguration# Disk Store Path: /home/tomcat/tomcat7_jdk7_2/temp
::30.702 DEBUG net.sf.ehcache.util.PropertyUtil# propertiesString is null.
::30.713 DEBUG net.sf.ehcache.config.ConfigurationHelper# No CacheManagerEventListenerFactory class specified. Skipping...
::30.729 DEBUG net.sf.ehcache.Cache# No BootstrapCacheLoaderFactory class specified. Skipping...
::30.729 DEBUG net.sf.ehcache.Cache# CacheWriter factory not configured. Skipping...
::30.731 DEBUG net.sf.ehcache.config.ConfigurationHelper# No CacheExceptionHandlerFactory class specified. Skipping...
::31.559 INFO alibaba.dubbo.registry.zookeeper.ZookeeperRegistry# [DUBBO] Load registry store file /home/tomcat/.dubbo/dubb
::31.572 DEBUG org.I0Itec.zkclient.ZkConnection# Creating new ZookKeeper instance to connect to 192.168.35.2:.
::31.578 INFO org.I0Itec.zkclient.ZkEventThread# Starting ZkClient event thread.
::31.584 INFO org.apache.zookeeper.ZooKeeper# Client environment:zookeeper.version=3.4.-, built on // : GMT
::31.584 INFO org.apache.zookeeper.ZooKeeper# Client environment:host.name=iZ25iig1og4Z
::31.584 INFO org.apache.zookeeper.ZooKeeper# Client environment:java.version=1.7.0_80
::31.584 INFO org.apache.zookeeper.ZooKeeper# Client environment:java.vendor=Oracle Corporation
::31.585 INFO org.apache.zookeeper.ZooKeeper# Client environment:java.home=/opt/java/jdk1..0_80/jre
::31.585 INFO org.apache.zookeeper.ZooKeeper# Client environment:java.class.path=/opt/tomcat/apache-tomcat-7.0./bin/bootstrap.jar:/opt/tomcat/apache-tomcat-7.0./bin/tomcat-juli.jar
::31.585 INFO org.apache.zookeeper.ZooKeeper# Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
::31.585 INFO org.apache.zookeeper.ZooKeeper# Client environment:java.io.tmpdir=/home/tomcat/tomcat7_jdk7_2/temp
::31.585 INFO org.apache.zookeeper.ZooKeeper# Client environment:java.compiler=<NA>
::31.586 INFO org.apache.zookeeper.ZooKeeper# Client environment:os.name=Linux
::31.586 INFO org.apache.zookeeper.ZooKeeper# Client environment:os.arch=amd64
::31.586 INFO org.apache.zookeeper.ZooKeeper# Client environment:os.version=2.6.-431.23..el6.x86_64
::31.586 INFO org.apache.zookeeper.ZooKeeper# Client environment:user.name=tomcat
::31.586 INFO org.apache.zookeeper.ZooKeeper# Client environment:user.home=/home/tomcat
::31.586 INFO org.apache.zookeeper.ZooKeeper# Client environment:user.dir=/opt/tomcat/apache-tomcat-7.0./bin
::31.587 INFO org.apache.zookeeper.ZooKeeper# Initiating client connection, connectString=192.168.35.2: sessionTimeout= watcher=org.I0Itec.zkclient.ZkClient@3c4ff559
::31.602 DEBUG org.I0Itec.zkclient.ZkClient# Awaiting connection to Zookeeper server
::31.606 DEBUG org.I0Itec.zkclient.ZkClient# Waiting for keeper state SyncConnected
::31.608 INFO org.apache.zookeeper.ClientCnxn# Opening socket connection to server 192.168.35.2/192.168.35.2:. Will not attempt to authenticate using SASL (unknown error)
::31.614 INFO org.apache.zookeeper.ClientCnxn# Socket connection established to 192.168.35.2/192.168.35.2:, initiating session
::31.625 INFO org.apache.zookeeper.ClientCnxn# Session establishment complete on server 192.168.35.2/192.168.35.2:, sessionid = 0x151de41a1800146, negotiated timeout =
::31.627 DEBUG org.I0Itec.zkclient.ZkClient# Received event: WatchedEvent state:SyncConnected type:None path:null
::31.627 INFO org.I0Itec.zkclient.ZkClient# zookeeper state changed (SyncConnected)
::31.627 DEBUG org.I0Itec.zkclient.ZkClient# Leaving process event
::31.627 DEBUG org.I0Itec.zkclient.ZkClient# State is SyncConnected
::31.681 INFO alibaba.dubbo.registry.zookeeper.ZookeeperRegistry# [DUBBO] Register: consumer://192.168.35.2/com.rockbb.credipay...
::31.726 INFO alibaba.dubbo.registry.zookeeper.ZookeeperRegistry# [DUBBO] Subscribe: consumer://192.168.35.2/com.rockbb.credipay...
::31.751 INFO alibaba.dubbo.registry.zookeeper.ZookeeperRegistry# [DUBBO] Notify urls for subscribe url consumer://192.168.35.2/com.rockbb.credipay...
::31.776 WARN ework.web.context.support.XmlWebApplicationContext# Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marketTask': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rockbb.credipay.commons.api.service.DayInterestService com.rockbb.credipay.daemon.task.MarketTask.dayInterestService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dayInterestService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.rockbb.credipay.commons.api.service.DayInterestService. No provider available for the service com.rockbb.credipay.commons.api.service.DayInterestService from the url zookeeper://192.168.35.2:2181/com.alibaba.dubbo.registry.RegistryService?application=celt-daemon-machine&default.version=develop-machine&dubbo=2.5.3&interface=com.rockbb.credipay.commons.api.service.DayInterestService&methods=update,count,batchUpdate,select,list,doVirtualCapitalInterest,insert,selectVirtualCapitalInterest&pid=26624&revision=1.0-SNAPSHOT&side=consumer&timestamp=1464788911437 to the consumer 192.168.35.2 use dubbo version 2.5.3
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:) ~[spring-beans-4.1..RELEASE.jar:4.1..RELEASE]

从最后几行的日志中可以看到, 在Dubbo注册后, 初始化SpringContext的过程中出现了错误, 导致初始化失败.

但zkClient线程还是正常启动, zookeeper服务器重启,zkClient开始重连,连接上zookeeper服务器;
zkClient触发watch的一些代码,ClassLoader尝试加载org/apache/zookeeper/proto/SetWatches类,但是发现找不到类,于是抛出异常;
zkClient捕获到异常,认为重连失败,close掉connection,休眠几秒之后,再次重连;
于是出现了zkClient反复重试连接zookeeper服务器的情况

要避免这种问题: 不能在dubbo消费端正在启动的时候, 关闭/重启所有可用的服务端.

Dubbo消费端错误: ClassNotFoundException: org.apache.zookeeper.proto.WatcherEvent的更多相关文章

  1. 启动dubbo消费端过程提示No provider available for the service的问题定位与解决

    文/朱季谦 某次在启动dubbo消费端时,发现无法从zookeeper注册中心获取到所依赖的消费者API,启动日志一直出现这样的异常提示 Failed to check the status of t ...

  2. Dubbo入门到精通学习笔记(十二):Dubbo消费端直连提供者(开发调试)、Dubbo服务只订阅(开发调试)、Dubbo服务只注册

    文章目录 Dubbo消费端直连提供者(开发调试) Dubbo服务只订阅(开发调试) Dubbo服务只注册 Dubbo消费端直连提供者(开发调试) Dubbo 官方文档: 用户指南 >> 示 ...

  3. java.lang.NoClassDefFoundError: org/apache/zookeeper/proto/SetWatches

    Session 0x16b21fa441900b6 for server 192.168.240.126/192.168.240.126:2181, unexpected error, closing ...

  4. Download and Install Apache Zookeeper on Ubuntu

    http://www.techburps.com/misc/download-and-install-apache-zookeepr/36 In previous article of this Bi ...

  5. Zookeeper异常org.apache.zookeeper.KeeperException$ConnectionLossException

    在虚拟机上安装了CenOS Linux系统,然后配置好了 zookeeper的集群环境,在本地写了一个Zookeeper测试程序,如下: package com.xbq.zookeeper; impo ...

  6. Spring boot dubbo+zookeeper 搭建------基于gradle项目的消费端与服务端分离实战

    1. Dubbo简介 Dubbo是Alibaba开源的分布式框架,是RPC模式的一种成熟的框架,优点是可以与Spring无缝集成,应用到我们的后台程序中.具体介绍可以查看Dubbo官网. 2. Why ...

  7. Dubbo学习笔记2:Dubbo服务提供端与消费端应用的搭建

    Demo结构介绍 Demo使用Maven聚合功能,里面有三个模块,目录如下: 其中Consumer模块为服务消费者,里面TestConsumer和consumer.xml组成了基于Spring配置方式 ...

  8. 源码分析Dubbo服务消费端启动流程

    通过前面文章详解,我们知道Dubbo服务消费者标签dubbo:reference最终会在Spring容器中创建一个对应的ReferenceBean实例,而ReferenceBean实现了Spring生 ...

  9. Dubbo学习笔记4:服务消费端泛化调用与异步调用

    本文借用dubbo.learn的Dubbo API方式来解释原理. 服务消费端泛化调用 前面我们讲解到,基于Spring和基于Dubbo API方式搭建简单的分布式系统时,服务消费端引入了一个SDK二 ...

随机推荐

  1. 10、ASP.NET MVC入门到精通——Model(模型)和验证

    本系列目录:ASP.NET MVC4入门到精通系列目录汇总 模型就是处理业务,想要保存.创建.更新.删除的对象. 注解(通过特性实现) DisplayName Required StringLengt ...

  2. 字符编码笔记:ASCII,Unicode和UTF-8

    很久很久以前,有一群人,他们决定用8个可以开合的晶体管来组合成不同的状态,以表示世界上的万物.他们看到8个开关状态是好的,于是他们把这称为"字节". 再后来,他们又做了一些可以处理 ...

  3. OS.js – 开源的 Web OS 系统,赶快来体验

    OS.js 是一个开源的 Web OS 系统,可以在浏览器中运行,提供了窗口管理器,应用程序API,用户界面开发套件和抽象的文件系统等.可以部署在 Node 或者 PHP 环境中运行.OS.js is ...

  4. 码代码新神器-Github Atom

    周末闲着没事,逛论坛发现了一个新的编辑器,由github发布的Atom编辑器.瞬间被吸引了,所以就去尝试着折腾了一下,后来发现这个编辑器确实很不错,他的特点就是两个字:优美!!! 下载地址,官方网站下 ...

  5. asp.net mvc 简易通用自定义Pager实现分页

    asp.net mvc 自定义Pager实现分页 Intro 一个WEB应用程序中经常会用到数据分页,本文将实现一个简单通用的分页组件,包含一个 PagerModel (用来保存页码信息),一个 Ht ...

  6. DOM事件揭秘-事件流

    事件:文档/窗口中发生的特定的交互瞬间 瀑布流,图片轮播 动作都是通过事件触发的 课程内容: 1,理解事件流 2,使用时间处理程序 3,不同的事件类型 ie4.0以后, 事件流:描述的是从页面中接收事 ...

  7. mysql NOW,CURRENT_TIMESTAMP,SYSDATE 之间的区别

    这些函数都可以返回当前的系统时间,但它们之间有什么区别呢??大家先看一下以下这个例子. select NOW(), CURRENT_TIMESTAMP(),SYSDATE(); 从上面的例子可以看出返 ...

  8. Android 应用程序集成FaceBook 登录及二次封装

    1.首先在Facebook 开发者平台注册一个账号 https://developers.facebook.com/ 开发者后台  https://developers.facebook.com/ap ...

  9. iOS 最新版 CocoaPods 的安装流程

    iOS 最新版 CocoaPods 的安装流程1.移除现有Ruby默认源$gem sources --remove https://rubygems.org/2.使用新的源$gem sources - ...

  10. IOS开发之学习《AV Foundation 开发秘籍》

    敲了这么久的代码,查阅了很多资料,都是网络电子版的,而且时间久了眼睛也累了,还不如看一下纸质的书籍,让眼睛休息休息. 本篇开始学习<AV Foundation 开发秘籍>,并记录对自己本人 ...