You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@servicecomb.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/01/10 03:37:00 UTC

[jira] [Commented] (SCB-214) AbstractServiceRegistry findServiceInstance do not process null return value

    [ https://issues.apache.org/jira/browse/SCB-214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16319650#comment-16319650 ] 

ASF GitHub Bot commented on SCB-214:
------------------------------------

weichao666 opened a new pull request #499: [SCB-214] AbstractServiceRegistry findServiceInstance process null return value, not print too much exception
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/499
 
 
   Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   AbstractServiceRegistry findServiceInstance process null return value, not print too much exception

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> AbstractServiceRegistry findServiceInstance do not process null return value
> ----------------------------------------------------------------------------
>
>                 Key: SCB-214
>                 URL: https://issues.apache.org/jira/browse/SCB-214
>             Project: Apache ServiceComb
>          Issue Type: Bug
>          Components: Java-Chassis
>            Reporter: WeiChao
>            Assignee: WeiChao
>             Fix For: java-chassis-1.0.0-m2
>
>
> 问题1:
> [2018-01-09 20:31:16,387/GMT+08:00][main][INFO]instance registry succeeds for the first time, will send AFTER_REGISTRY event. io.servicecomb.core.CseApplicationListener$1.afterRegistryInstance(CseApplicationListener.java:173)
> java.lang.NullPointerException
> at io.servicecomb.serviceregistry.registry.AbstractServiceRegistry.findServiceInstance(AbstractServiceRegistry.java:207)
> at io.servicecomb.serviceregistry.RegistryUtils.findServiceInstance(RegistryUtils.java:208)
> at com.huawei.paas.monitor.MonitorBootListener.onBootEvent(MonitorBootListener.java:26)
> at io.servicecomb.core.CseApplicationListener.triggerEvent(CseApplicationListener.java:100)
> at io.servicecomb.core.CseApplicationListener$1.afterRegistryInstance(CseApplicationListener.java:175)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
> at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
> at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
> at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
> at com.google.common.eventbus.EventBus.post(EventBus.java:275)
> at io.servicecomb.serviceregistry.task.AbstractTask.run(AbstractTask.java:54)
> at io.servicecomb.serviceregistry.task.CompositeTask.run(CompositeTask.java:35)
> at io.servicecomb.serviceregistry.task.ServiceCenterTask.init(ServiceCenterTask.java:83)
> at io.servicecomb.serviceregistry.registry.AbstractServiceRegistry.run(AbstractServiceRegistry.java:168)
> at io.servicecomb.serviceregistry.registry.RemoteServiceRegistry.run(RemoteServiceRegistry.java:79)
> at io.servicecomb.serviceregistry.RegistryUtils.run(RegistryUtils.java:68)
> at io.servicecomb.core.CseApplicationListener.onApplicationEvent(CseApplicationListener.java:136)
> at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
> at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
> at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:383)
> at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:337)
> at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:882)
> at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545)
> at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
> at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
> at io.servicecomb.foundation.common.utils.BeanUtils.init(BeanUtils.java:37)
> at io.servicecomb.foundation.common.utils.BeanUtils.init(BeanUtils.java:33)
> at com.huawei.paas.cse.demo.springmvc.server.SpringmvcServer.main(SpringmvcServer.java:39)
> [2018-01-09 20:31:16,399/GMT+08:00][registry-vert.x-eventloop-thread-0][WARN]{"errorCode":"400012","errorMessage":"Micro-service does not exist","detail":"No provider matched."}
> io.servicecomb.serviceregistry.client.http.ServiceRegistryClientImpl.lambda$null$4(ServiceRegistryClientImpl.java:178)
> com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "errorCode" (class io.servicecomb.serviceregistry.api.response.FindInstancesResponse), not marked as ignorable (one known property: "instances"])
> at [Source: [B@3cb976a1; line: 1, column: 15] (through reference chain: io.servicecomb.serviceregistry.api.response.FindInstancesResponse["errorCode"])
> at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:62)
> at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:834)
> at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1093)
> at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1489)
> at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1467)
> at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:282)
> at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140)
> at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3814)
> at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2945)
> at io.servicecomb.foundation.common.utils.JsonUtils.readValue(JsonUtils.java:53)
> at io.servicecomb.serviceregistry.client.http.ServiceRegistryClientImpl.lambda$null$4(ServiceRegistryClientImpl.java:175)
> at io.vertx.core.http.impl.HttpClientResponseImpl$BodyHandler.notifyHandler(HttpClientResponseImpl.java:307)
> at io.vertx.core.http.impl.HttpClientResponseImpl.lambda$bodyHandler$0(HttpClientResponseImpl.java:197)
> at io.vertx.core.http.impl.HttpClientResponseImpl.handleEnd(HttpClientResponseImpl.java:261)
> at io.vertx.core.http.impl.ClientConnection.handleResponseEnd(ClientConnection.java:358)
> at io.vertx.core.http.impl.ClientHandler.handleMessage(ClientHandler.java:100)
> at io.vertx.core.http.impl.ClientHandler.handleMessage(ClientHandler.java:36)
> at io.vertx.core.net.impl.VertxHandler.lambda$channelRead$1(VertxHandler.java:150)
> at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:342)
> at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:200)
> at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:148)
> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372)
> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358)
> at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350)
> at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372)
> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358)
> at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350)
> at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435)
> at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
> at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
> at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250)
> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372)
> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358)
> at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350)
> at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)
> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372)
> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358)
> at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)
> at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:129)
> at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:610)
> at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:551)
> at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:465)
> at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:437)
> at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
> at java.lang.Thread.run(Thread.java:745)
> 问题2:解析json失败,打印太多异常,代码需要优化
> if (response.statusCode() == 304) {
> mInstances.setNeedRefresh(false);
> } else {
> mInstances.setInstancesResponse(JsonUtils.readValue(bodyBuffer.getBytes(), FindInstancesResponse.class));
> }
> 需要考虑400, 304, 200等错误码。 只有200的时候,才需要解析json内容。
>  
> [2018-01-09 20:31:16,399/GMT+08:00][registry-vert.x-eventloop-thread-0][WARN]{"errorCode":"400012","errorMessage":"Micro-service does not exist","detail":"No provider matched."}
> io.servicecomb.serviceregistry.client.http.ServiceRegistryClientImpl.lambda$null$4(ServiceRegistryClientImpl.java:178)
> com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "errorCode" (class io.servicecomb.serviceregistry.api.response.FindInstancesResponse), not marked as ignorable (one known property: "instances"])
> at [Source: [B@3cb976a1; line: 1, column: 15] (through reference chain: io.servicecomb.serviceregistry.api.response.FindInstancesResponse["errorCode"])
> at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:62)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)