报错:dubbo3.3.0报错Invoker for gRPC not found
折磨了很久没有发现原因,只好一点点查日志,最后发现注册元信息的时候org.apache.dubbo.metadata.MetadataService注册到dubbo的端口20880,org.apache.dubbo.metadata.MetadataServiceV2注册到tri的端口50051,导致查询元信息的时候这个方法找不到MetadataService/getMetadataInfo,因为
如题,升级dubbo3.3.0,使用dubbo和tri双协议注册,报错
.r.p.t.h.AbstractServerTransportListener : [DUBBO] An error occurred while processing the http request with GrpcHttp2ServerTransportListener, Http2MetadataFrame{method='POST', path='/org.apache.dubbo.metadata.MetadataService/getMetadataInfo', contentType='application/grpc+proto', streamId=3, endStream=false}, dubbo version: 3.3.0, current host:
org.apache.dubbo.remoting.http12.exception.HttpStatusException: Invoker for gRPC not found
.....
折磨了很久没有发现原因,只好一点点查日志,最后发现注册元信息的时候org.apache.dubbo.metadata.MetadataService注册到dubbo的端口20880,org.apache.dubbo.metadata.MetadataServiceV2注册到tri的端口50051,导致查询元信息的时候这个方法找不到MetadataService/getMetadataInfo,因为这里是默认的tri协议走的50051端口,
源码中针对MetadataService的选择有做说明,如下,大意是:
MetadataServiceV2 与其他语言的 dubbo 实现(dubbo-go)具有更好的兼容性。
如果设置为 false(默认):
1. 如果您的服务使用三重协议且未设置 {@link #metadataServiceProtocol}
- Dubbo 将同时导出 MetadataService 和 MetadataServiceV2,并具有三重
2. 设置 {@link #metadataServiceProtocol} = tri
- Dubbo 将同时导出 MetadataService 和 MetadataServiceV2,并具有三重
3. 设置 {@link #metadataServiceProtocol} != tri
- Dubbo 只会导出 MetadataService
4. 您的服务没有使用三重协议,并且未设置 {@link #metadataServiceProtocol}
- Dubbo 只会导出 MetadataService
如果设置为 true,dubbo 将尝试仅使用 MetadataServiceV2。
仅当满足以下至少一种情况时才会激活:
1. 手动设置 {@link #metadataServiceProtocol} = tri
2. 您的服务使用三重协议
综上:只需要将metadata-service-protocol: dubbo指定为dubbo(非tri),就可以全部按MetadataService暴露而不是V2。
/**
* Only use the new version of metadataService (MetadataServiceV2).
* <br> MetadataServiceV2 have better compatibility with other language's dubbo implement (dubbo-go).
* <br> If set to false (default):
* <br> 1. If your services are using triple protocol and {@link #metadataServiceProtocol} is not set
* <br> - Dubbo will export both MetadataService and MetadataServiceV2 with triple
* <br> 2. Set {@link #metadataServiceProtocol} = tri
* <br> - Dubbo will export both MetadataService and MetadataServiceV2 with triple
* <br> 3. Set {@link #metadataServiceProtocol} != tri
* <br> - Dubbo will only export MetadataService
* <br> 4. Your services are not using triple protocol, and {@link #metadataServiceProtocol} is not set
* <br> - Dubbo will only export MetadataService
* <br>
* <br> If set to true, dubbo will try to only use MetadataServiceV2.
* <br> It only activates when meet at least one of the following cases:
* <br> 1. Manually set {@link #metadataServiceProtocol} = tri
* <br> 2. Your services are using triple protocol
* <br>
*/
private Boolean onlyUseMetadataV2;
更多推荐
所有评论(0)