apache / dubbo-go

Go Implementation For Apache Dubbo .
https://dubbo.apache.org/
Apache License 2.0
4.71k stars 925 forks source link

go-client can not invoke java-server in right way #71

Closed kingjarry closed 5 years ago

kingjarry commented 5 years ago

1.go-client can not parse POJO in right way when java-server provide "Byte" as return panic: Failed to invoke the method getTuple in the service com.*******.TupleProvider. Tried 3 times of the providers [dubbo://:@192.168.97.78:13675/com.*******.TupleProvider?group=&version= dubbo://:@192.168.97.78:13675/com.*******.TupleProvider?group=&version= dubbo://:@192.168.97.78:13675/com.*******.TupleProvider?group=&version=] (3/1)from the registry zookeeper://:@192.168.11.29:2181?group=&registry=zookeeper&registry.role=0&registry.timeout=3s on the consumer 192.168.97.78 using the dubbo version 2.6.0. Last error is unknown struct member type: int8. 2.go-client can not invoke nonparameter method provides by java-server panic: runtime error: index out of range

public class Tuple implements Serializable {
    private static final long serialVersionUID = -1L;

    Integer Integer;
    Byte Byte;
    Short Short;
    Long Long;
    int i;
    byte b;
    short s;
    long l;
}

public interface TupleProvider {

    Tuple getTuple(Integer i);

    Tuple getTheTuple();
}

@Component
public class TupleProviderImpl implements TupleProvider {

    @Override
    public Tuple getTuple(Integer i) {
        return getTheTuple();
    }

    @Override
    public Tuple getTheTuple() {
        Tuple result = new Tuple();
        result.setB((byte) 1);
        result.setByte(Byte.valueOf("1"));
        result.setI(1);
        result.setInteger(Integer.valueOf("1"));
        result.setL(1L);
        result.setLong(Long.valueOf("1"));
        result.setS((short) 1);
        result.setShort(Short.valueOf("1"));
        return result;

    }
}

type Tuple struct {
    Byte    int8
    Short   int16
    Integer int32
    Long    int64
    B       int8
    S       int16
    I       int32
    L       int64
}

func (t Tuple) JavaClassName() string {
    return "com.***.Tuple"
}

type TupleProvider struct {
    GetTuple func(i int32) (tuple *Tuple, err error) `dubbo:"getTuple"`
    GetTheTuple func() (tuple *Tuple, err error) `dubbo:"getTheTuple"`
}

func (provider *TupleProvider) Service() string {
    return "com.***.TupleProvider"
}

func (provider *TupleProvider) Version() string {
    return ""
}
wongoo commented 5 years ago

@buqujquibuqu tks, we will check it asap.

wongoo commented 5 years ago

fixed in https://github.com/dubbogo/hessian2/releases/tag/v1.0.2