@AlbumenJ 这个问题任然存在 (3.1.3)
case 1 泛化调用
@Test
public void testGenericService() {
ReferenceConfig<GenericService> config = new ReferenceConfig<>();
config.setInterface("org.apache.dubbo.samples.local.api.DemoService");
config.setGeneric(Boolean.TRUE.toString());
String result = (String)config.get().$invoke("sayHello", new String[]{"java.lang.String"}, new String[]{"world"});
}
case 2
@Activate(group = {CommonConstants.PROVIDER, CommonConstants.CONSUMER})
public class DubboRequestFilter implements Filter {
private final static Logger log = LoggerFactory.getLogger(DubboRequestFilter.class);
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
RpcContext.getServiceContext().isConsumerSide();
Result invoke = invoker.invoke(invocation);
//NPE
RpcContext.getServiceContext().isConsumerSide();
return invoke;
}
}
case 3
java.lang.NullPointerException: null
at org.apache.dubbo.rpc.RpcServiceContext.isConsumerSide(RpcServiceContext.java:144)
at org.apache.dubbo.rpc.RpcContext.isConsumerSide(RpcContext.java:275)
at com....XxxDubboFilter.invoke(XxxDubboFilter.java:28)
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:327)
at com.alibaba.csp.sentinel.adapter.dubbo.DubboAppContextFilter.invoke(DubboAppContextFilter.java:43)
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:327)
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CallbackRegistrationInvoker.invoke(FilterChainBuilder.java:194)
at org.apache.dubbo.rpc.proxy.InvocationUtil.invoke(InvocationUtil.java:56)
at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:75)
at org.apache.dubbo.metadata.MetadataServiceDubboProxy0.getMetadataInfo(MetadataServiceDubboProxy0.java)
at org.apache.dubbo.registry.client.metadata.MetadataUtils.getRemoteMetadata(MetadataUtils.java:173)