zalopay-oss / jmeter-grpc-plugin

A JMeter plugin supports load test gRPC
Apache License 2.0
42 stars 23 forks source link

Error - java.lang.NoClassDefFoundError: io/grpc/stub/AbstractStub$StubFactory #8

Closed Milanista99 closed 4 years ago

Milanista99 commented 4 years ago

Hello,

We are trying to add this plugin to JMeter, but encounter an error, could you please help with it? We did everything as in the manual:

The error is the following: java.lang.NoClassDefFoundError: io/grpc/stub/AbstractStub$StubFactory at java.lang.Class.getDeclaredMethods0(Native Method) ~[?:1.8.0_251] at java.lang.Class.privateGetDeclaredMethods(Unknown Source) ~[?:1.8.0_251] at java.lang.Class.privateGetMethodRecursive(Unknown Source) ~[?:1.8.0_251] at java.lang.Class.getMethod0(Unknown Source) ~[?:1.8.0_251] at java.lang.Class.getMethod(Unknown Source) ~[?:1.8.0_251] at vn.zalopay.jmeter.grpc.utils.GrpcUtils.getBlockingStub(GrpcUtils.java:164) ~[jmeter-grpc-client-sampler.jar:?] at vn.zalopay.jmeter.grpc.client.GrpcClientSampler.initGrpcClient(GrpcClientSampler.java:77) ~[jmeter-grpc-client-sampler.jar:?] at vn.zalopay.jmeter.grpc.client.GrpcClientSampler.sample(GrpcClientSampler.java:89) ~[jmeter-grpc-client-sampler.jar:?] at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:630) ~[ApacheJMeter_core.jar:5.3] at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) ~[ApacheJMeter_core.jar:5.3] at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) ~[ApacheJMeter_core.jar:5.3] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) ~[ApacheJMeter_core.jar:5.3] at java.lang.Thread.run(Unknown Source) [?:1.8.0_251] Caused by: java.lang.ClassNotFoundException: io.grpc.stub.AbstractStub$StubFactory at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_251] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_251] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_251] ... 13 more

thoainguyen commented 4 years ago

Hi @Milanista99,

Please attach two of .jar here, and your .jmx file. With the above description, I feel hard to know the problem exactly

Best regard Thoai nguyen

thoainguyen commented 4 years ago

Hi @Milanista99 , if you pleasant want to run the example in README, Follow the README, I have created two .jar and .jmx file and attached below resources.zip

Milanista99 commented 4 years ago

Hi, Thank you for your fast reply. Please find the files attached. In the meantime, I will try the example :)

Thank you! files.zip

thoainguyen commented 4 years ago

Hi @Milanista99 , First, your examples-1.29.0.jar may contain/cause conflicted grpc version. Secondly, the JMX had a problem here screenshot You cann't use vars keyword without initialize it before BR, Thoai nguyen

Milanista99 commented 4 years ago

Hi again, With your example and the files you sent it is almost good :) The server receives the messages and the JMeter the responses. However, in JMeter there are also some errors like this: 2020-05-28 11:24:34,941 ERROR v.z.j.g.c.GrpcClientSampler: Call sample has thrown an exception: 020-05-28 11:24:34,932 ERROR v.z.j.g.c.GrpcClientSampler: Call sample has thrown an exception: java.lang.reflect.InvocationTargetException: null at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_231] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_231] at vn.zalopay.jmeter.grpc.client.GrpcClientSampler.sample(GrpcClientSampler.java:97) [jmeter-grpc-client-sampler.jar:?] at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:627) [ApacheJMeter_core.jar:5.2.1] at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:551) [ApacheJMeter_core.jar:5.2.1] at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:490) [ApacheJMeter_core.jar:5.2.1] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257) [ApacheJMeter_core.jar:5.2.1] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231] Caused by: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 29945500ns. [remote_addr=localhost/127.0.0.1:50051] at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:235) ~[jmeter-grpc-client-sampler.jar:?] at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:216) ~[jmeter-grpc-client-sampler.jar:?] at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:141) ~[jmeter-grpc-client-sampler.jar:?] at io.grpc.examples.helloworld.GreeterGrpc$GreeterBlockingStub.sayHello(GreeterGrpc.java:159) ~[grpc-lib-0.0.1.jar:?] ... 9 more

thoainguyen commented 4 years ago

Hi @Milanista99 , I set deadline 30 milisecond for each call, increase to 3000 milisecond for example to fix, see in timeout edittext

Milanista99 commented 4 years ago

Thank you for the quick help and the willingness Now it works like a charm :)