Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: java-client can not get error message when go-server return error #68

Closed
chenleirr opened this issue Jun 4, 2019 · 5 comments · Fixed by #82
Closed

Bug: java-client can not get error message when go-server return error #68

chenleirr opened this issue Jun 4, 2019 · 5 comments · Fixed by #82
Labels
bug Something isn't working
Projects

Comments

@chenleirr
Copy link

My code is as follows

go-server
image

java-client
image

The problem is that exception java catched is not contain the go error message which should be ‘invalid params: uid, name, cert could not be empty’.

In fact, java-client always catch as follows:

Failed to invoke the method Init in the service com.xxx.service.go.base.certify.api.CertifyService. Tried 1 times of the providers [10.71.8.70:20001] (1/1) from the registry 10.71.8.70:2181 on the consumer 10.71.8.70 using the dubbo version 2.6.3. Last error is: Failed to invoke remote method: Init, provider: dubbo://10.71.8.70:20001/com.xxx.service.go.base.certify.api.CertifyService?anyhost=true&app.version=1.0&application=consumer-of-certify-app&category=providers&check=false&cluster=failover&dubbo=dubbo-provider-golang-2.6.0&environment=dev&group=&interface=com.xxx.service.go.base.certify.api.CertifyService&ip=192.168.99.1&loadbalance=random&methods=Init&methods.Init.loadbalance=random&methods.Init.retries=3&methods.Init.weight=0&module=dubbogo+certify+server&name=CertifyService&organization=test.com&owner=raychen&pid=71023&register.ip=10.71.8.70&remote.timestamp=1559621785&retries=0&service.filter=echo&side=consumer&timestamp=1559622450690&version=&warmup=100, cause: 0

@hxmhlt hxmhlt added the bug Something isn't working label Jun 4, 2019
@hxmhlt
Copy link
Contributor

hxmhlt commented Jun 4, 2019

We can discuss in here. @fangyincheng @wongoo

@hxmhlt
Copy link
Contributor

hxmhlt commented Jun 4, 2019

related issue: https://github.com/dubbogo/hessian2/issues/53

@hxmhlt hxmhlt changed the title java-client can not get error message when go-server return error Bug: java-client can not get error message when go-server return error Jun 4, 2019
@hxmhlt hxmhlt added this to To do in Dubbogo Jun 4, 2019
@hxmhlt
Copy link
Contributor

hxmhlt commented Jun 4, 2019

Can we convert error in Go to exception in Java instead of Golang developers have to register a java pojo 'Exception' . ? I think both error in Go & Exception in Java is basic type .

@fangyincheng
Copy link
Contributor

Now, I think there are two ways:

  1. In hessian2, we can decode it as error when decoding a exception.
  2. RegisterPOJO! Define some Exception struct(eg: IOException、RemotingException etc.). We can define a Exception struct named Exception, and then, users need to define their own XxxException. But many exception class of java SDK will must be define by users.

What do you think?

@hxmhlt
Copy link
Contributor

hxmhlt commented Jun 4, 2019

Maybe we can do both. User can define the java exception POJO in go and register it. Also we can provide some standard POJOs of java exception that are often used instead of all of them. If Hessian2 finds neither the standard POJO corresponding to exception nor the user-defined-registered one, then Hessian2 can decode exception as error in go through the rules we define.

fangyincheng referenced this issue in fangyincheng/dubbo-go Jun 6, 2019
Dubbogo automation moved this from To do to Done Jun 7, 2019
ralf0131 added a commit that referenced this issue Jun 7, 2019
LaurenceLiZhixin pushed a commit to LaurenceLiZhixin/dubbo-go that referenced this issue Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Dubbogo
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants