新手使用dubbo,新增表结构的时候,报接口被禁止调用:
2018-05-11 15:37:17.211 ERROR 24416 --- [io-18082-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.alibaba.dubbo.rpc.RpcException: Forbid consumer 10.21.66.40 access service com.ai.rai.interests.operation.api.IRecomprodApi from registry 10.20.16.74:2181 use dubbo version 2.5.3, Please check registry access list (whitelist/blacklist).] with root cause
com.alibaba.dubbo.rpc.RpcException: Forbid consumer 10.21.66.40 access service com.ai.rai.interests.operation.api.IRecomprodApi from registry 10.20.16.74:2181 use dubbo version 2.5.3, Please check registry access list (whitelist/blacklist).
at com.alibaba.dubbo.registry.integration.RegistryDirectory.doList(RegistryDirectory.java:579) ~[dubbo-2.5.3.jar:2.5.3]
at com.alibaba.dubbo.rpc.cluster.directory.AbstractDirectory.list(AbstractDirectory.java:73) ~[dubbo-2.5.3.jar:2.5.3]
解决方案:
需要同时在dubbo-provider.xml和dubbo-consumer.xml中配置要爆露的接口和接收的接口:
provider配置:
<dubbo:service ref="iRecomprodApi" interface="com.ai.rai.interests.operation.api.IRecomprodApi" />
consumer配置:
<dubbo:reference id="iRecomprodApi" interface="com.ai.rai.interests.operation.api.IRecomprodApi" />