首页

关于RpcException: Forbid consumer .. access service com.alibaba.dubbo.rpc.service.GenericService from registry.. Please check registry access list (whitelist/blacklist)问题

标签:RpcException,GenericService,dubbo,whitelist/blacklist,服务异常,注册中心无服务     发布时间:2018-09-14   

一、异常描述

关于访问alibaba的dubbo服务zk注册中心的服务提供者dubbo协议接口,报"Caused by: com.alibaba.dubbo.rpc.RpcException: Forbid consumer..access service com.alibaba.dubbo.rpc.service.GenericService from registry..:2181 use dubbo version 2.4.16, Please check registry access list (whitelist/blacklist)."错误异常,详情日志如下>>

[20:44:05.139] [ERROR] [<T=D0MMkwJch1cOoobO>] ProcessStatusServiceImpl:  ProcessStatusServiceImpl_getPageList_exception【{..}】@b@com.xwood.soofa.appclient.AppClientException: #0ms#Invoked..@b@        at com.xwood.soofa.appclient.DefaultActionClient._perform(DefaultActionClient.java:131) ~[sbase-common.jar:5.2.6]@b@        at com.xwood.soofa.appclient.DefaultActionClient.doInvoke(DefaultActionClient.java:52) ~[sbase-common.jar:5.2.6]@b@        at com.xwood.soofa.appclient.BaseServiceClient.invoke(BaseServiceClient.java:133) ~[sbase-common.jar:5.2.6]@b@        at com.xwood.pms.templet.sao.impl.ProcessStatusListQuerySAOImpl.invoke(ProcessStatusListQuerySAOImpl.java:46) ~[classes/:?]@b@        at com.xwood.pms.templet.sao.impl.ProcessStatusListQuerySAOImpl.invoke(ProcessStatusListQuerySAOImpl.java:62) ~[classes/:?]@b@        at com.xwood.pms.templet.sao.impl.ProcessStatusListQuerySAOImpl$$FastClassBySpringCGLIB$$ee1106f3.invoke(<generated>) ~[spring-core-3.2.13.RELEASE.jar:?]@b@        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:700) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at com.xwood.pms.templet.aop.LogAppendAdvice.logSAO(LogAppendAdvice.java:126) ~[classes/:?]@b@        at sun.reflect.GeneratedMethodAccessor9073.invoke(Unknown Source) ~[?:?]@b@        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_80]@b@        at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_80]@b@        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:633) ~[spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at com.xwood.pms.templet.sao.impl.ProcessStatusListQuerySAOImpl$$EnhancerBySpringCGLIB$$29316962.invoke(<generated>) ~[spring-core-3.2.13.RELEASE.jar:?]@b@        at com.xwood.pms.templet.service.impl.ProcessStatusServiceImpl.getPageList(ProcessStatusServiceImpl.java:43) [classes/:?]@b@        at com.xwood.pms.templet.web.controller.ProcessStatusSynController.searchEntry(ProcessStatusSynController.java:49) [classes/:?]@b@        at com.xwood.pms.templet.web.controller.ProcessStatusSynController$$FastClassBySpringCGLIB$$96dffcb1.invoke(<generated>) [spring-core-3.2.13.RELEASE.jar:?]@b@        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) [spring-core-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:700) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at com.xwood.pms.templet.aop.LogAppendAdvice.logController(LogAppendAdvice.java:47) [classes/:?]@b@        at sun.reflect.GeneratedMethodAccessor9180.invoke(Unknown Source) ~[?:?]@b@        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_80]@b@        at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_80]@b@        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:633) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at com.xwood.pms.templet.web.controller.ProcessStatusSynController$$EnhancerBySpringCGLIB$$faeb9560.searchEntry(<generated>) [spring-core-3.2.13.RELEASE.jar:?]@b@        at sun.reflect.GeneratedMethodAccessor9357.invoke(Unknown Source) ~[?:?]@b@        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_80]@b@        at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_80]@b@        at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:743) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:672) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:82) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]@b@        at com.xwood.soofa.sbase.web.DefWebRequestHandler.handleRequest(DefWebRequestHandler.java:61) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.filter.DefaultFilterChain.doFinal(DefaultFilterChain.java:64) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.filter.DefaultFilterChain.doFilter(DefaultFilterChain.java:57) [sbase.jar:5.2.6]@b@        at com.xwood.pms.templet.common.filter.XssSecurityFilter.doFilter(XssSecurityFilter.java:49) [classes/:?]@b@        at com.xwood.soofa.sbase.web.filter.DefaultFilterChain.doFilter(DefaultFilterChain.java:52) [sbase.jar:5.2.6]@b@        at com.xwood.pms.templet.common.filter.OperationFilter.doFilter(OperationFilter.java:119) [classes/:?]@b@        at com.xwood.soofa.sbase.web.filter.DefaultFilterChain.doFilter(DefaultFilterChain.java:52) [sbase.jar:5.2.6]@b@        at com.xwood.brcp.ea.client.sbase5.servlet.AuthorizeWebFilter.doFilter(AuthorizeWebFilter.java:38) [ea-client-sbase5-1.2.0.jar:?]@b@        at com.xwood.soofa.sbase.web.filter.DefaultFilterChain.doFilter(DefaultFilterChain.java:52) [sbase.jar:5.2.6]@b@        at com.xwood.brcp.ea.client.sbase5.servlet.EAClientWebFilter.doFilter(EAClientWebFilter.java:38) [ea-client-sbase5-1.2.0.jar:?]@b@        at com.xwood.soofa.sbase.web.filter.DefaultFilterChain.doFilter(DefaultFilterChain.java:52) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.filter.impl.PostJsonToFormFilter.doFilter(PostJsonToFormFilter.java:38) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.filter.DefaultFilterChain.doFilter(DefaultFilterChain.java:52) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.filter.impl.FileUploadFilter.doFilter(FileUploadFilter.java:40) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.filter.DefaultFilterChain.doFilter(DefaultFilterChain.java:52) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.DefWebDispatcher.handleRequest(DefWebDispatcher.java:134) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.sar.SARContextBean.handleWebRequest(SARContextBean.java:170) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.sbaseWebRequestHandler.handleRequest(sbaseWebRequestHandler.java:44) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.filter.DefaultFilterChain.doFinal(DefaultFilterChain.java:64) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.filter.DefaultFilterChain.doFilter(DefaultFilterChain.java:57) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.filter.impl.CommonWebFilter.doFilter(CommonWebFilter.java:46) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.filter.DefaultFilterChain.doFilter(DefaultFilterChain.java:52) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.web.DefsbaseWebDispatcher.dispatch(DefsbaseWebDispatcher.java:80) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.sbaseContextBean.handleWebRequest(sbaseContextBean.java:182) [sbase.jar:5.2.6]@b@        at com.xwood.soofa.sbase.protocol.web.sbaseServletFilter.doFilter(sbaseServletFilter.java:55) [sbase.jar:5.2.6]@b@        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [catalina.jar:8.0.35]@b@        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [catalina.jar:8.0.35]@b@        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [catalina.jar:8.0.35]@b@        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [catalina.jar:8.0.35]@b@        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [catalina.jar:8.0.35]@b@        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [catalina.jar:8.0.35]@b@        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.35]@b@        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) [catalina.jar:8.0.35]@b@        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.35]@b@        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528) [catalina.jar:8.0.35]@b@        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099) [tomcat-coyote.jar:8.0.35]@b@        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) [tomcat-coyote.jar:8.0.35]@b@        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520) [tomcat-coyote.jar:8.0.35]@b@        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) [tomcat-coyote.jar:8.0.35]@b@        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_80]@b@        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_80]@b@        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.35]@b@        at java.lang.Thread.run(Thread.java:745) [?:1.7.0_80]@b@Caused by: com.alibaba.dubbo.rpc.RpcException: Forbid consumer 192.168.1.19 access service com.alibaba.dubbo.rpc.service.GenericService from registry 192.168.1.100:2181 use dubbo version 2.4.16, Please check registry access list (whitelist/blacklist).@b@        at com.alibaba.dubbo.registry.integration.RegistryDirectory.doList(RegistryDirectory.java:579) ~[dubbo.jar:2.4.16]@b@        at com.alibaba.dubbo.rpc.cluster.directory.AbstractDirectory.list(AbstractDirectory.java:73) ~[dubbo.jar:2.4.16]@b@        at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.list(AbstractClusterInvoker.java:260) ~[dubbo.jar:2.4.16]@b@        at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:219) ~[dubbo.jar:2.4.16]@b@        at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:72) ~[dubbo.jar:2.4.16]@b@        at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52) ~[dubbo.jar:2.4.16]@b@        at com.alibaba.dubbo.common.bytecode.proxy9.$invoke(proxy9.java) ~[?:2.4.16]@b@        at com.xwood.soofa.appclient.dubbo.DubboServiceRequestHandler.handleRequest(DubboServiceRequestHandler.java:26) ~[sbase-common.jar:5.2.6]@b@        at com.xwood.soofa.appclient.dubbo.ApplicationControllerDubboClient.handleRequest(ApplicationControllerDubboClient.java:62) ~[sbase-common.jar:5.2.6]@b@        at com.xwood.soofa.sbase.context.support.LocalPriorityApplicationControllerClient.handleRequest(LocalPriorityApplicationControllerClient.java:48) ~[sbase.jar:5.2.6]@b@        at com.xwood.soofa.appclient.DefaultActionClient._perform(DefaultActionClient.java:102) ~[sbase-common.jar:5.2.6]@b@        ... 92 more

二、问题分析

1. 根据异常轨迹日志对应RegistryDirectory源码的579行,是否抛异常由于forbidden被设置为true

package com.alibaba.dubbo.registry.integration;@b@@b@...@b@@b@public class RegistryDirectory<T> extends AbstractDirectory<T> implements NotifyListener {@b@@b@...@b@@b@   public List<Invoker<T>> doList(Invocation invocation) {@b@   @b@//# 579行@b@        if (forbidden) {@b@            throw new RpcException(RpcException.FORBIDDEN_EXCEPTION, "Forbid consumer " +  NetUtils.getLocalHost() + " access service " + getInterface().getName() + " from registry " + getUrl().getAddress() + " use dubbo version " + Version.getVersion() + ", Please check registry access list (whitelist/blacklist).");@b@        }@b@        List<Invoker<T>> invokers = null; @b@        ...@b@        @b@    }@b@}

2. RegistryDirectory源码类中在未注入服务等,因此this.forbidden问题

  package com.alibaba.dubbo.registry.integration;@b@@b@..@b@@b@public  class  RegistryDirectory{@b@@b@   private void refreshInvoker(List<URL> invokerUrls){@b@        if (invokerUrls != null && invokerUrls.size() == 1 && invokerUrls.get(0) != null@b@                && Constants.EMPTY_PROTOCOL.equals(invokerUrls.get(0).getProtocol())) {@b@            this.forbidden = true; // 禁止访问@b@           ..@b@        } else {@b@            this.forbidden = false; // 允许访问@b@           ..@b@        }@b@    }@b@    @b@    }

3. 根据2中发现在服务协议没有成功注入到注册中心,因为判断问题是因此服务提供方应用服务