Closed unexpectedxx closed 3 years ago
错误信息呢?
org.apache.dubbo.rpc.RpcException: Invalid token! Forbid invoke remote service interface com.xx.rpcapi.CommonRpcService method getAreaInfo() from consumer 127.0.0.1 to provider 127.0.0.1
at org.apache.dubbo.rpc.filter.TokenFilter.invoke(TokenFilter.java:51)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83)
at org.apache.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:77)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83)
at org.apache.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:129)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83)
at org.apache.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:152)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83)
at org.apache.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83)
at org.apache.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:41)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83)
at org.apache.dubbo.rpc.protocol.injvm.InjvmInvoker.doInvoke(InjvmInvoker.java:63)
at org.apache.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:163)
at org.apache.dubbo.rpc.protocol.AsyncToSyncInvoker.invoke(AsyncToSyncInvoker.java:52)
at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:78)
at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:89)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83)
at org.apache.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:51)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83)
at org.apache.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:69)
at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:83)
at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:74)
at org.apache.dubbo.common.bytecode.proxy0.getAreaInfo(proxy0.java)
at com.xx.rpcapi.EnterpriseRpcServiceImpl.createEnterprise(EnterpriseRpcServiceImpl.java:84)
at com.xx.rpcapi.EnterpriseRpcServiceImpl$$FastClassBySpringCGLIB$$88618f89.invoke(
隐式参数token跟url指定的token不一致看源码就知道了
String token = invoker.getUrl().getParameter(TOKEN_KEY); if (ConfigUtils.isNotEmpty(token)) { Class<?> serviceType = invoker.getInterface(); Map<String, String> attachments = inv.getAttachments(); String remoteToken = attachments == null ? null : attachments.get(TOKEN_KEY); if (!token.equals(remoteToken)) { throw new RpcException("Invalid token! Forbid invoke remote service " + serviceType + " method " + inv.getMethodName() + "() from consumer " + RpcContext.getContext().getRemoteHost() + " to provider " + RpcContext.getContext().getLocalHost()); } }
我也遇到了 和你 一样的问题,我也 提了个 issue , 目前感觉 没啥 解决方案 , 我觉得 得先把它关掉了
Dubbo token needs to be completed through the registration center.
Hello, for the current local exposure call, the server opens the token, and the client call fails. We pass the token to the server in the InjvmInvoker.doInvoke method to solve the problem.
Environment
Steps to reproduce this issue
Pls. provide [GitHub address] to reproduce this issue.
Expected Result
What do you expected from the above steps?
Actual Result
What actually happens?
If there is an exception, please attach the exception trace: