Closed Summary-wcj closed 2 years ago
Did you enable the sofa plugin?
I'll have a look.
Did you enable the sofa plugin? Yes, I did
I'll have a look.
thank you
please tell me your shenyu version,zookeeper version and detail log.
please tell me your shenyu version,zookeeper version and detail log.
1、shenyu version:I pulled the master branch 2、zookeeper:3.6.3 3、Error log when I request:
2022-06-01 10:45:00 [shenyu-netty-nio-2] INFO org.apache.shenyu.plugin.base.AbstractShenyuPlugin - sofa selector success match , selector name :/sofa
2022-06-01 10:45:00 [shenyu-netty-nio-2] INFO org.apache.shenyu.plugin.base.AbstractShenyuPlugin - sofa rule success match , rule name :/sofa/findById
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.curator.framework.imps.CuratorFrameworkImpl - Starting
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:zookeeper.version=3.6.3--6401e4ad2087061bc6b9f80dec2d69f2e3c8660a, built on 04/08/2021 16:35 GMT
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:host.name=yyzq
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:java.version=1.8.0_311
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:java.vendor=Oracle Corporation
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:java.home=D:\JavaSoftware\jdk\jre
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:java.class.path=C:\Users\Administrator\AppData\Local\Temp\classpath239163284.jar;D:\Idea\2021.2\plugins\java\lib\rt\debugger-agent.jar
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:java.library.path=D:\JavaSoftware\jdk\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Python310\Scripts\;C:\Python310\;D:\Vm\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;D:\JavaSoftware\jdk\bin;D:\JavaSoftware\jdk\jre\bin;G:\DEV_ENV\apache-maven-3.8.4\bin;D:\Git\Git\bin;C:\ProgramData\chocolatey\bin;D:\NodeJs\node_global;D:\NodeJs\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;D:\VSCode\Microsoft VS Code\bin;D:\NodeJs\node_global;;.
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:java.compiler=<NA>
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:os.name=Windows 10
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:os.arch=amd64
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:os.version=10.0
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:user.name=Administrator
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:user.home=C:\Users\Administrator
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:user.dir=G:\DEV_ENV\wcj\incubator-shenyu
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:os.memory.free=167MB
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:os.memory.max=3618MB
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Client environment:os.memory.total=419MB
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ZooKeeper - Initiating client connection, connectString=127.0.0.1:2181 sessionTimeout=60000 watcher=org.apache.curator.ConnectionState@5bfe4119
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.common.X509Util - Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ClientCnxnSocket - jute.maxbuffer value is 1048575 Bytes
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.zookeeper.ClientCnxn - zookeeper.request.timeout value is 0. feature enabled=false
2022-06-01 10:45:01 [shenyu-netty-nio-2-SendThread(127.0.0.1:2181)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server activate.navicat.com/127.0.0.1:2181.
2022-06-01 10:45:01 [shenyu-netty-nio-2-SendThread(127.0.0.1:2181)] INFO org.apache.zookeeper.ClientCnxn - SASL config status: Will not attempt to authenticate using SASL (unknown error)
2022-06-01 10:45:01 [shenyu-netty-nio-2-SendThread(127.0.0.1:2181)] INFO org.apache.zookeeper.ClientCnxn - Socket connection established, initiating session, client: /127.0.0.1:60526, server: activate.navicat.com/127.0.0.1:2181
2022-06-01 10:45:01 [shenyu-netty-nio-2] INFO org.apache.curator.framework.imps.CuratorFrameworkImpl - Default schema
2022-06-01 10:45:01 [shenyu-netty-nio-2-SendThread(127.0.0.1:2181)] INFO org.apache.zookeeper.ClientCnxn - Session establishment complete on server activate.navicat.com/127.0.0.1:2181, session id = 0x1000010f7f5000c, negotiated timeout = 40000
2022-06-01 10:45:02 [shenyu-netty-nio-2-EventThread] INFO org.apache.curator.framework.state.ConnectionStateManager - State change: CONNECTED
2022-06-01 10:45:02 [shenyu-netty-nio-2-EventThread] INFO org.apache.curator.framework.imps.EnsembleTracker - New config event received: {}
2022-06-01 10:45:02 [shenyu-netty-nio-2-EventThread] INFO org.apache.curator.framework.imps.EnsembleTracker - New config event received: {}
2022-06-01 10:45:32 [shenyu-netty-nio-2] INFO org.apache.shenyu.plugin.sofa.cache.ApplicationConfigCache - init sofa reference success there meteData is :MetaData{id='1531828904198914048', appName='sofa', contextPath='/sofa', path='/sofa/findById', rpcType='sofa', serviceName='org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService', methodName='findById', parameterTypes='java.lang.String', rpcExt='{"loadbalance":"hash","retries":3,"timeout":-1}', enabled=true}
2022-06-01 10:45:33 [shenyu-netty-nio-2] ERROR org.apache.shenyu.web.handler.GlobalErrorHandler - handle error: [899ef27f-1] Resolved [SofaRouteException: RPC-020060001: 没有获得服务[org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService:1.0]的调用地址,请检查服务是否已经推送 ] for HTTP POST /sofa/findById
com.alipay.sofa.rpc.core.exception.SofaRouteException: RPC-020060001: 没有获得服务[org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService:1.0]的调用地址,请检查服务是否已经推送
at com.alipay.sofa.rpc.client.AbstractCluster.noAvailableProviderException(AbstractCluster.java:490)
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
*__checkpoint ⇢ org.apache.shenyu.web.configuration.ErrorHandlerConfiguration$1 [DefaultWebFilterChain]
*__checkpoint ⇢ org.apache.shenyu.web.filter.FileSizeFilter [DefaultWebFilterChain]
*__checkpoint ⇢ org.apache.shenyu.web.filter.CrossFilter [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.security.web.server.authorization.AuthorizationWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.security.web.server.authentication.logout.LogoutWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.security.web.server.savedrequest.ServerRequestCacheWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.security.web.server.context.ReactorContextWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.security.web.server.header.HttpHeaderWriterWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.security.config.web.server.ServerHttpSecurity$ServerWebExchangeReactorContextWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.security.web.server.WebFilterChainProxy [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ HTTP POST "/sofa/findById" [ExceptionHandlingWebHandler]
Original Stack Trace:
at com.alipay.sofa.rpc.client.AbstractCluster.noAvailableProviderException(AbstractCluster.java:490)
at com.alipay.sofa.rpc.client.AbstractCluster.select(AbstractCluster.java:419)
at com.alipay.sofa.rpc.client.FailoverCluster.doInvoke(FailoverCluster.java:65)
at com.alipay.sofa.rpc.client.AbstractCluster.invoke(AbstractCluster.java:297)
at com.alipay.sofa.rpc.client.ClientProxyInvoker.invoke(ClientProxyInvoker.java:83)
at com.alipay.sofa.rpc.api.GenericService_proxy_0.$genericInvoke(GenericService_proxy_0.java)
at org.apache.shenyu.plugin.sofa.proxy.SofaProxyService.genericInvoker(SofaProxyService.java:98)
at org.apache.shenyu.plugin.sofa.SofaPlugin.doExecute(SofaPlugin.java:82)
at org.apache.shenyu.plugin.base.AbstractShenyuPlugin.execute(AbstractShenyuPlugin.java:93)
at org.apache.shenyu.web.handler.ShenyuWebHandler$DefaultShenyuPluginChain.lambda$execute$0(ShenyuWebHandler.java:214)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157)
at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)
at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:299)
at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onNext(FluxFilterFuseable.java:337)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816)
at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:159)
at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)
at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)
at reactor.netty.channel.FluxReceive.terminateReceiver(FluxReceive.java:468)
at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:260)
at reactor.netty.channel.FluxReceive.request(FluxReceive.java:129)
at reactor.core.publisher.FluxMap$MapSubscriber.request(FluxMap.java:164)
at reactor.core.publisher.FluxPeek$PeekSubscriber.request(FluxPeek.java:138)
at reactor.core.publisher.FluxMap$MapSubscriber.request(FluxMap.java:164)
at reactor.core.publisher.MonoCollect$CollectSubscriber.onSubscribe(MonoCollect.java:103)
at reactor.core.publisher.FluxMap$MapSubscriber.onSubscribe(FluxMap.java:92)
at reactor.core.publisher.FluxPeek$PeekSubscriber.onSubscribe(FluxPeek.java:171)
at reactor.core.publisher.FluxMap$MapSubscriber.onSubscribe(FluxMap.java:92)
at reactor.netty.channel.FluxReceive.startReceiver(FluxReceive.java:167)
at reactor.netty.channel.FluxReceive.lambda$subscribe$2(FluxReceive.java:146)
at io.netty.util.concurrent.AbstractEventExecutor.runTask$$$capture(AbstractEventExecutor.java:174)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute$$$capture(AbstractEventExecutor.java:167)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Disconnected from the target VM, address: '127.0.0.1:60390', transport: 'socket'
Process finished with exit code 130
4、This is the information on ZK: providers:
/sofa-rpc/org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService/providers/bolt%3A%2F%2F192.168.233.182%3A8888%3Fversion%3D1.0%26accepts%3D100000%26appName%3Dsofa%26weight%3D100%26language%3Djava%26pid%3D13856%26interface%3Dorg.apache.shenyu.examples.sofa.api.service.SofaSingleParamService%26timeout%3D0%26serialization%3Dhessian2%26protocol%3Dbolt%26delay%3D-1%26dynamic%3Dtrue%26startTime%3D1654063199007%26id%3DsofaSingleParamService%26uniqueId%3D%26rpcVer%3D50507
consumers:
/sofa-rpc/org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService/consumers/bolt%3A%2F%2F192.168.233.182%3Fversion%3D1.0%26uniqueId%3D%26pid%3D17108%26timeout%3D-1%26id%3Drpc-cfg-0%26generic%3Dtrue%26interface%3Dorg.apache.shenyu.examples.sofa.api.service.SofaSingleParamService%26appName%3Dshenyu_proxy%26serialization%3Dhessian2%26startTime%3D1654063240365%26pid%3D17108%26language%3Djava%26rpcVer%3D50706
I also encountered the same situation, zk version tested 3.7 and 3.8
I find code:
if (CommonUtils.isEmpty(providerInfos)) {
/**
* 如果注册中心没有provider,可能上下文中指定了provider
*
* 注册中心如果没有provider可用列表,需要识别上下文中是否存在直连Provider:
* 1. RpcInvokeContext.getContext().getTargetUrl()
*/
if (context != null) {
String targetIP = (String) context.getAttachment(RpcConstants.HIDDEN_KEY_PINPOINT);
if (StringUtils.isNotBlank(targetIP)) {
// 如果上下文指定provider,直接返回
ProviderInfo providerInfo = selectPinpointProvider(targetIP, providerInfos);
return providerInfo;
}
}
throw noAvailableProviderException(message.getTargetServiceUniqueName());
} else {
originalProviderInfos = new ArrayList<>(providerInfos);
}
I also encountered the same situation, zk version tested 3.7 and 3.8
I find code:
if (CommonUtils.isEmpty(providerInfos)) { /** * 如果注册中心没有provider,可能上下文中指定了provider * * 注册中心如果没有provider可用列表,需要识别上下文中是否存在直连Provider: * 1. RpcInvokeContext.getContext().getTargetUrl() */ if (context != null) { String targetIP = (String) context.getAttachment(RpcConstants.HIDDEN_KEY_PINPOINT); if (StringUtils.isNotBlank(targetIP)) { // 如果上下文指定provider,直接返回 ProviderInfo providerInfo = selectPinpointProvider(targetIP, providerInfos); return providerInfo; } } throw noAvailableProviderException(message.getTargetServiceUniqueName()); } else { originalProviderInfos = new ArrayList<>(providerInfos); }
Is this the source code of sofa? Did you meet it, too? What's a good way now
I didn't solve it
I didn't solve it
I didn't solve it
This should be a bug
Have you tried adding below dependencies in bootstrap
?
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-client</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>4.0.1</version>
</dependency>
I didn't solve it
This should be a bug
yes ! We are trying to fix it, if you are interested in this topic, please feel free to contribute~
I created a PR for this issue. Feel free to leave comment.
The root cause is curator version incompatible.
Have you tried adding below dependencies in
bootstrap
?<dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-client</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> <version>4.0.1</version> </dependency>
In version 2.4.3, there is this version of curator. I have tried it without any problem. but I have not tried it on the master branch
Have you tried adding below dependencies in
bootstrap
?<dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-client</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> <version>4.0.1</version> </dependency>
In version 2.4.3, there is this version of curator. I have tried it without any problem. but I have not tried it on the master branch
You can pull the newest master branch and test again, it should be fixed. But pay attention, please don't use zk as data sync. I'll fix it in future PR.
Have you tried adding below dependencies in
bootstrap
?<dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-client</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> <version>4.0.1</version> </dependency>
In version 2.4.3, there is this version of curator. I have tried it without any problem. but I have not tried it on the master branch
hi~ the version 2.4.3 is no problem.
This question may be related to this pr
see : https://github.com/apache/incubator-shenyu/pull/3388/files
Have you tried adding below dependencies in
bootstrap
?<dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-client</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> <version>4.0.1</version> </dependency>
In version 2.4.3, there is this version of curator. I have tried it without any problem. but I have not tried it on the master branch
You can pull the newest master branch and test again, it should be fixed. But pay attention, please don't use zk as data sync. I'll fix it in future PR.
Well thank you.
Have you tried adding below dependencies in
bootstrap
?<dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-client</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> <version>4.0.1</version> </dependency>
In version 2.4.3, there is this version of curator. I have tried it without any problem. but I have not tried it on the master branch
hi~ the version 2.4.3 is no problem.
This question may be related to this pr
see : https://github.com/apache/incubator-shenyu/pull/3388/files
thank you.
Have you tried adding below dependencies in
bootstrap
?<dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-client</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> <version>4.0.1</version> </dependency>
In version 2.4.3, there is this version of curator. I have tried it without any problem. but I have not tried it on the master branch
You can pull the newest master branch and test again, it should be fixed. But pay attention, please don't use zk as data sync. I'll fix it in future PR.
Well thank you.
Hello, which version of ZK synchronization data is available
Hi @Summary-wcj , the PR which fix the zk data sync issue has been merged. Now you can pull the master branch and use zk data sync~ The versions of supported ZK should be >= 3.5.
你好@Summary-wcj,修复 zk 数据同步问题的 PR 已合并。现在你可以拉取master分支并使用zk数据同步 了~ 支持的ZK版本应该>= 3.5。
Thank you very much. I have seen the updated records
Question
I used the local startup method to test the interface of sofa. The following errors occurred. The registry used was zookeeper and the example provided on the official website was used
Error log printed by the gateway when called
2022-05-31 15:34:38 [boundedElastic-3] INFO org.apache.shenyu.plugin.base.AbstractShenyuPlugin - sofa selector success match , selector name :/sofa 2022-05-31 15:34:38 [boundedElastic-3] INFO org.apache.shenyu.plugin.base.AbstractShenyuPlugin - sofa rule success match , rule name :/sofa/findAll 2022-05-31 15:34:38 [boundedElastic-3] ERROR org.apache.shenyu.web.handler.GlobalErrorHandler - [b54a2486] Resolved [SofaRouteException: RPC-020060001: 没有获得服务[org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService:1.0]的调用地址,请检查服务是否已经推送 ] for HTTP GET /sofa/findAll
Information on zookeeper