You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/08/17 09:42:46 UTC
[GitHub] [dubbo-go-hessian2] jjhewlett opened a new issue #220: go-hessian2报错 error:decObject illegal object type tag:121
jjhewlett opened a new issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220
go-hessian2报错 error:decObject illegal object type tag:121
我是Java服务端,dubbo-go是客户端。
现在Data是java下发的一个List,list里每一个元素,都是实体对象
下发单个没问题,下发list的就go-hessian2抛异常
hessian.RegisterPOJO(&ResponseData{})
type ResponseData struct {
Code string
Msg string
Data interface{}
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675371047
@wongoo 目前data没有被解析出来
![image](https://user-images.githubusercontent.com/69667512/90496512-801e0e80-e178-11ea-82ae-7b1288d3f1fd.png)
import (
hessian "github.com/apache/dubbo-go-hessian2"
"fmt"
)
type ResponseData struct {
Code string
Msg string
Data map[string]interface{}
}
func (ResponseData) JavaClassName() string {
return "com.example.dubbo_tools.domain.ResponseData"
}
func main() {
res := &ResponseData{}
res.Code = "0000"
res.Msg = "成功"
list := []string{"A","B","C"}
data := map[string]interface{}{
"count" : 1,
"data" : list,
}
res.Data = data
e := hessian.NewEncoder()
err := e.Encode(res)
if err != nil {
panic(err)
}
bytes := e.Buffer()
decoder := hessian.NewDecoder(bytes)
decode, err := decoder.Decode()
if err != nil {
panic(err)
}
fmt.Println(decode)
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] AlexStocks commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
AlexStocks commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675351850
@jjhewlett why u define so complicated map?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] wongoo commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675279582
not support now, u can create a new struct extending the exist one and overwrite the JavaClassName func
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett edited a comment on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett edited a comment on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675371047
@wongoo 目前data没有被解析出来
![image](https://user-images.githubusercontent.com/69667512/90496512-801e0e80-e178-11ea-82ae-7b1288d3f1fd.png)
```Go
import (
hessian "github.com/apache/dubbo-go-hessian2"
"fmt"
)
type ResponseData struct {
Code string
Msg string
Data map[string]interface{}
}
func (ResponseData) JavaClassName() string {
return "com.example.dubbo_tools.domain.ResponseData"
}
func main() {
res := &ResponseData{}
res.Code = "0000"
res.Msg = "成功"
list := []string{"A","B","C"}
data := map[string]interface{}{
"count" : 1,
"data" : list,
}
res.Data = data
e := hessian.NewEncoder()
err := e.Encode(res)
if err != nil {
panic(err)
}
bytes := e.Buffer()
decoder := hessian.NewDecoder(bytes)
decode, err := decoder.Decode()
if err != nil {
panic(err)
}
fmt.Println(decode)
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675280044
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675274605
@wongoo 您好。看了下pojo.go的代码,
好像是一个JavaClassName 对应一个goName。
不知道可不可以实现多个JavaClassName 对应一个goName呢
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] wongoo commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-674819270
there should be a `JavaClassName()` func for the struct.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675207190
@wongoo 我在Go语言的客户端已经注册了order的结构体了
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] wongoo commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675213205
@jjhewlett u can create a test case so that we can work on it, ref the example as follow:
https://github.com/apache/dubbo-go-hessian2/blob/9e91fc9a7de335e427999bd3cd9cd60ef0304169/test_hessian/src/main/java/test/TestCustomReply.java#L428
https://github.com/apache/dubbo-go-hessian2/blob/9e91fc9a7de335e427999bd3cd9cd60ef0304169/object_test.go#L767
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675208937
@wongoo
目前还没有解决这个问题,我目前也很苦恼
在JAVA服务层,我的DATA是个泛型。
我尝试过go客户端的response data改成[]interface{},但是改成这样我的详情就直接抛相同的异常了。
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] wongoo commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675208360
glad to hear that, and u can post how that you resolve your problem, maybe it's useful for others.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675214446
@wongoo 好的,我先看下测试用例。真的万分感谢。
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] AlexStocks commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
AlexStocks commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-676050557
@jjhewlett u r welcome. Would u help us to register ur com/org info into https://github.com/apache/dubbo-go/issues/2? thank u so much.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] milerL commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
milerL commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-706046872
> @AlexStocks 非常感谢您的邀请,目前我们公司还是以JAVA为主。以后我有新的机会的时候会尝试dubbo-go。
go的客户端 strcut 看着好奇怪啊。。能看一下你的ResponseData Struct 吗
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675351180
@wongoo 你好,
服务端返回的是一个map.
map有2个key,一个key是int,一个key是list
该如何定义。才能够正常解析。
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-676853511
@AlexStocks 非常感谢您的邀请,目前我们公司还是以JAVA为主。以后我有新的机会的时候会尝试dubbo-go。
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] wongoo commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675203885
@jjhewlett more details needed, include java object definition, java test data, code sample. And I guess, u only register ResponseData, but not for order object. u need register all objects.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] wongoo commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675352928
@jjhewlett 你最好按照上面我给你的例子写一个test case,把问题模拟出来,这样才好分析问题出在哪里。 比如这个issue https://github.com/apache/dubbo-go-hessian2/issues/214 就是一个很好的例子。
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675202677
@wongoo 我都已经设置好了的。
GetOrder这个方法返回的是一个order list
GetOrderOne 返回的是一个order object
响应的数据结构都是ResponseData
![image](https://user-images.githubusercontent.com/69667512/90461058-e8003500-e137-11ea-9152-0368589ce1f1.png)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] milerL commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
milerL commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-706046872
> @AlexStocks 非常感谢您的邀请,目前我们公司还是以JAVA为主。以后我有新的机会的时候会尝试dubbo-go。
go的客户端 strcut 看着好奇怪啊。。能看一下你的ResponseData Struct 吗
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] milerL commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
milerL commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-706505851
@jjhewlett 打扰了 问一下你们有没有遇到过
外面用Response包了一层 然后Response里面有个result 字段返回 结构体或者int 这种情况
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675920236
非常感谢 @wongoo @AlexStocks 这两位大神的技术支持。现在已经和JAVA端通信成功了。
因为Golang语法不支持泛型。已经将代码改成如下
![image](https://user-images.githubusercontent.com/69667512/90608613-73abbb80-e235-11ea-91e9-85da1ffecd4d.png)
返回结果:
![image](https://user-images.githubusercontent.com/69667512/90608775-a8b80e00-e235-11ea-807b-71603f35cfab.png)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett commented on issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett commented on issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220#issuecomment-675206910
@wongoo 这个是JAVA服务端的代码,现在getOrderOne是可以正常返回的。
![image](https://user-images.githubusercontent.com/69667512/90461984-59d97e00-e13a-11ea-8481-94eb3bbc5c9c.png)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] jjhewlett closed issue #220: go-hessian2报错 error:decObject illegal object type tag:121
Posted by GitBox <gi...@apache.org>.
jjhewlett closed issue #220:
URL: https://github.com/apache/dubbo-go-hessian2/issues/220
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org