Load Test SSE Services with JMeter help | JMeter Forum
A
aazim.ahmad85 Posted on 23/01/2019

Hi,

 I am trying to load test sse services with JMETER via java sampler. My java class works fine and connects to stream. but when i try to export java program to jar and then use that jar in jmeter as java sampler, it gives me classnot found error. can you please help me with this? I am attaching the java project and jmeter project with this query

 

How to run Java Project:

1. Open Project in eclipse

2. add all libraries inside ./extJar as external jars to project build path

3. Run Main method in AppTest class (this will show that the stream is being read by logic)

 

Here are the steps i followed.

1. Created a java project and imported two external jars from jmeter install directory

a. ApacheJMeter_core.jar

b. ApacheJMeter_java.jar

2. Created java sampler class in eclipse extending AbstractJavaSamplerClient

3. Created some other logic for SSE events handling. All the external libraries required for this are kept in ./extJar folder

4. Exported the project into Jar

5. Placed this Jar into lib/ext folder of jmeter 

6. Created a jmeter project and used java sampler

7. chose the class the dropdown

8. Run the test.

Observations: observed following error

2019-01-22 15:18:22,013 INFO o.a.j.e.StandardJMeterEngine: Running the test!
2019-01-22 15:18:22,013 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2019-01-22 15:18:22,016 INFO o.a.j.p.j.t.JavaTest: Created class: com.jm.sse.SSEJMSamp. Uses tearDownTest: true
2019-01-22 15:18:22,016 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, *local*)
2019-01-22 15:18:22,113 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
2019-01-22 15:18:22,113 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group Thread Group.
2019-01-22 15:18:22,114 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
2019-01-22 15:18:22,114 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 perThread=1000.0 delayedStart=false
2019-01-22 15:18:22,114 INFO o.a.j.t.ThreadGroup: Started thread group number 1
2019-01-22 15:18:22,114 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started
2019-01-22 15:18:22,115 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-1
2019-01-22 15:18:22,116 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-1
2019-01-22 15:18:22,116 ERROR o.a.j.JMeter: Uncaught exception:
java.lang.NoClassDefFoundError: javax/ws/rs/client/ClientBuilder
at com.jm.sse.SSERequest.makeRequest(SSERequest.java:39) ~[jmTest.jar:?]
at com.jm.sse.SSEJMSamp.runTest(SSEJMSamp.java:44) ~[jmTest.jar:?]
at org.apache.jmeter.protocol.java.sampler.JavaSampler.sample(JavaSampler.java:197) ~[ApacheJMeter_java.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:622) ~[ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546) ~[ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486) ~[ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253) ~[ApacheJMeter_core.jar:5.0 r1840935]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
2019-01-22 15:18:22,117 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
2019-01-22 15:18:22,117 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*)


A
aazim.ahmad85 Replied on 23/01/2019

There was issue with the way i was creating jar. As the project has dependencies on external jars, I had to create one single fat jar for the project including all dependencies. I used maven to achieve this and then it worked.