Skip to content

When the RPC protocol is HTTP, use GenericService.$invoke call error. #1768

@ningyu1

Description

@ningyu1

dubbo version

dubbo-2.6.1

provider service

public interface MyClassService {

    public String sayHello();

    public String sayHello(MyClassVo vo, @Min(1) long id);

}

provider config

<dubbo:application name="dubbo-test-main" />
<!-- 	<dubbo:registry address="N/A" /> -->
<dubbo:registry protocol="zookeeper"
		address="192.168.0.58:2181"/>
<dubbo:protocol port="8090" name="http" />
<dubbo:service protocol="http" interface="com.jiuyescm.dubbo.test.api.MyClassService" ref="myClassService"/>

consumer use registry

ApplicationConfig application = new ApplicationConfig();
application.setName("DubboSample");
ReferenceConfig reference = new ReferenceConfig();
reference.setApplication(application);
RegistryConfig registry = registry = new RegistryConfig();
registry.setProtocol("zookeeper");
registry.setAddress("192.168.0.58:2181");
reference.setRegistry(registry);
reference.setGeneric(true);
GenericService genericService = (GenericService) reference.get();
Object result = genericService.$invoke("sayHello", new String[]{}, new Object[]{});

consumer use dircet connection

ApplicationConfig application = new ApplicationConfig();
application.setName("DubboSample");
ReferenceConfig reference = new ReferenceConfig();
reference.setApplication(application);
reference.setUrl("http://192.168.6.47:8090/com.jiuyescm.dubbo.test.api.MyClassService")
reference.setGeneric(true);
GenericService genericService = (GenericService) reference.get();
Object result = genericService.$invoke("sayHello", new String[]{}, new Object[]{});

Error

2018/05/10 12:20:39 ERROR - cn.tsoft.framework.testing.jmeter.plugin.dubbo.sample.DubboSample: 接口返回异常: com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote service: interface com.alibaba.dubbo.rpc.service.GenericService, method: $invoke, cause: Invocation of method [public abstract java.lang.Object com.alibaba.dubbo.rpc.service.GenericService.$invoke(java.lang.String,java.lang.String[],java.lang.Object[]) throws com.alibaba.dubbo.rpc.service.GenericException] failed in HTTP invoker remote service at [http://192.168.6.47:8090/com.jiuyescm.dubbo.test.api.MyClassService]; nested exception is java.lang.NoSuchMethodException: com.sun.proxy.$Proxy18.$invoke(java.lang.String, [Ljava.lang.String;, [Ljava.lang.Object;)
	at com.alibaba.dubbo.rpc.protocol.AbstractProxyProtocol.getRpcException(AbstractProxyProtocol.java:119)
	at com.alibaba.dubbo.rpc.protocol.AbstractProxyProtocol$2.doInvoke(AbstractProxyProtocol.java:99)
	at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:142)
	at com.alibaba.dubbo.rpc.filter.GenericImplFilter.invoke(GenericImplFilter.java:172)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:53)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:74)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:47)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:73)
	at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:51)
	at com.alibaba.dubbo.common.bytecode.proxy0.$invoke(proxy0.java)
	at cn.tsoft.framework.testing.jmeter.plugin.dubbo.sample.DubboSample.callDubbo(DubboSample.java:463)
	at cn.tsoft.framework.testing.jmeter.plugin.dubbo.sample.DubboSample.sample(DubboSample.java:321)
	at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:465)
	at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:410)
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:241)
	at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.remoting.RemoteInvocationFailureException: Invocation of method [public abstract java.lang.Object com.alibaba.dubbo.rpc.service.GenericService.$invoke(java.lang.String,java.lang.String[],java.lang.Object[]) throws com.alibaba.dubbo.rpc.service.GenericException] failed in HTTP invoker remote service at [http://192.168.6.47:8090/com.jiuyescm.dubbo.test.api.MyClassService]; nested exception is java.lang.NoSuchMethodException: com.sun.proxy.$Proxy18.$invoke(java.lang.String, [Ljava.lang.String;, [Ljava.lang.Object;)
	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:158)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
	at com.sun.proxy.$Proxy8.$invoke(Unknown Source)
	at com.alibaba.dubbo.common.bytecode.Wrapper0.invokeMethod(Wrapper0.java)
	at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:45)
	at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:71)
	at com.alibaba.dubbo.rpc.protocol.AbstractProxyProtocol$2.doInvoke(AbstractProxyProtocol.java:94)
	... 18 more
Caused by: java.lang.NoSuchMethodException: com.sun.proxy.$Proxy18.$invoke(java.lang.String, [Ljava.lang.String;, [Ljava.lang.Object;)
	at java.lang.Class.getMethod(Class.java:1665)
	at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:204)
	at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:39)
	at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78)
	at org.springframework.remoting.support.RemoteInvocationBasedExporter.invokeAndCreateResult(RemoteInvocationBasedExporter.java:114)
	at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:74)
	at com.alibaba.dubbo.rpc.protocol.http.HttpProtocol$InternalHandler.handle(HttpProtocol.java:147)
	at com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet.service(DispatcherServlet.java:60)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:822)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:550)
	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:890)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:743)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:215)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:407)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:421)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
	at org.springframework.remoting.support.RemoteInvocationUtils.fillInClientStackTraceIfPossible(RemoteInvocationUtils.java:45)
	at org.springframework.remoting.support.RemoteInvocationResult.recreate(RemoteInvocationResult.java:149)
	at org.springframework.remoting.support.RemoteInvocationBasedAccessor.recreateRemoteInvocationResult(RemoteInvocationBasedAccessor.java:85)
	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:150)
	... 25 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions