-
Notifications
You must be signed in to change notification settings - Fork 114
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
go-hessian2报错 error:decObject illegal object type tag:121 #220
Comments
there should be a |
@wongoo 我都已经设置好了的。 |
@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. |
@wongoo 这个是JAVA服务端的代码,现在getOrderOne是可以正常返回的。 |
@wongoo 我在Go语言的客户端已经注册了order的结构体了 |
glad to hear that, and u can post how that you resolve your problem, maybe it's useful for others. |
@wongoo |
@jjhewlett u can create a test case so that we can work on it, ref the example as follow:
dubbo-go-hessian2/object_test.go Line 767 in 9e91fc9
|
@wongoo 好的,我先看下测试用例。真的万分感谢。 |
@wongoo 您好。看了下pojo.go的代码, |
not support now, u can create a new struct extending the exist one and overwrite the JavaClassName func |
OK,我试下继承重写。要是GO支持泛型就没那么麻烦了。 |
@wongoo 万分感谢 |
@wongoo 你好, |
@jjhewlett why u define so complicated map? |
@jjhewlett 你最好按照上面我给你的例子写一个test case,把问题模拟出来,这样才好分析问题出在哪里。 比如这个issue #214 就是一个很好的例子。 |
@wongoo 目前data没有被解析出来 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)
} |
非常感谢 @wongoo @AlexStocks 这两位大神的技术支持。现在已经和JAVA端通信成功了。 |
@jjhewlett u r welcome. Would u help us to register ur com/org info into apache/dubbo-go#2? thank u so much. |
@AlexStocks 非常感谢您的邀请,目前我们公司还是以JAVA为主。以后我有新的机会的时候会尝试dubbo-go。 |
go的客户端 strcut 看着好奇怪啊。。能看一下你的ResponseData Struct 吗 |
@jjhewlett 打扰了 问一下你们有没有遇到过 |
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{}
}
The text was updated successfully, but these errors were encountered: