Closed meiping05 closed 2 years ago
need more info
2021-11-30 10:30:52 [New I/O client worker #1-1] ERROR org.apache.shenyu.plugin.alibaba.dubbo.AlibabaDubboPlugin - dubbo failed using async genericInvoker() metaData=MetaData{id='1461601432558649344', appName='dubbo-sample-webapp', contextPath='/dubbo-sample-webapp', path='/dubbo-sample-webapp/student/findById', rpcType='dubbo', serviceName='com.meip.gateway.inf.StudentInterface', methodName='findById', parameterTypes='long', rpcExt='{"loadbalance":"random","retries":2,"timeout":3000,"sent":false}', enabled=true} param={"id":"10"} java.lang.RuntimeException: java.lang.RuntimeException: Illegal constructor: long java.lang.RuntimeException: Illegal constructor: long at org.apache.dubbo.common.utils.PojoUtils.newInstance(PojoUtils.java:580) at org.apache.dubbo.common.utils.PojoUtils.realize0(PojoUtils.java:472) at org.apache.dubbo.common.utils.PojoUtils.realize(PojoUtils.java:212) at org.apache.dubbo.common.utils.PojoUtils.realize(PojoUtils.java:99) at org.apache.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:104) at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$FilterChainNode.invoke(FilterChainBuilder.java:82) at org.apache.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$FilterChainNode.invoke(FilterChainBuilder.java:82) at org.apache.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:41) at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$FilterChainNode.invoke(FilterChainBuilder.java:82) at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:145) at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:100) at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:175) at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51) at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:41) at java.lang.Thread.run(Thread.java:748)
`public interface StudentInterface {
Student findById(long id);
List<Student> findByArrays(Long[] ids);
}`
`@DubboService public class StudentInterfaceImpl implements StudentInterface {
@Override
@ShenyuDubboClient(path = "/student/findById")
public Student findById(long id) {
return Student.builder().id(id).age(20).height(170).name("测试").sex(Sex.MALE).build();
}
@Override
@ShenyuDubboClient(path = "/student/findByArrays")
public List<Student> findByArrays(Long[] ids) {
return Arrays.stream(ids).map(x -> Student.builder().id(x).age(20).height(170).name("测试").sex(Sex.MALE).build()).collect(Collectors.toList());
}
}`
this have error?
List
findByArrays(Long[] ids);
hi ,The error log contains' Illegal constructor: long ' , Your pojo object constructor has no parameters?
public Student findById(long id) { return Student.builder().id(id).age(20).height(170).name("测试").sex(Sex.MALE).build(); }
public Student findById(Long id)
Can see the Student ?
Request is error not Response
` @Data @Builder public class Student implements Serializable {
private long id;
private String name;
private int age;
private Sex sex;
private int height;
}
`
对于方法参数类型数组
You can add @ NoArgsConstructor to Student
Or it could be a Dubbo BUG
Line : 84
` return Mono.fromFuture(invokeAsync(genericService, metaData.getMethodName(), pair.getLeft(), pair.getRight()).thenApply(ret -> { if (Objects.isNull(ret)) { ret = Constants.DUBBO_RPC_RESULT_EMPTY; } exchange.getAttributes().put(Constants.RPC_RESULT, ret); exchange.getAttributes().put(Constants.CLIENT_RESPONSE_RESULT_TYPE, ResultEnum.SUCCESS.getName()); return ret; })).onErrorMap(exception -> exception instanceof GenericException ? new ShenyuException(((GenericException) exception).getExceptionMessage()) : new ShenyuException(exception));
`
pair.getRight() is wrong
BodyParamUtils.buildSingleParameter
can you fix it in BodyParamUtils.buildSingleParameter? @meiping05
I try it
Have Other Contact Information ?
Is there an existing issue for this?
Current Behavior
Interface
Student findById(long id)
Invoke Failure
Expected Behavior
No response
Steps To Reproduce
No response
Environment
Debug logs
No response
Anything else?
No response