Issue
JMeter (5.5) doesn't see sampler class in Java request despite steps below being done:
- Sampler is in uber jar
- Jar was added to /lib and /lib/ext
- jmeter.properties user.classpath and search_path were tested (no luck)
- href="https://i.stack.imgur.com/AnvCk.png" rel="nofollow noreferrer">Jar was added in test plan in GUI
- Sampler is extending AbstractJavaSamplerClient
2022-08-30 15:27:34,324 ERROR o.a.j.p.j.c.g.JavaConfigGui: Error creating class:'package.SseSampler' in JavaSampler ${__threadNum} SSE ${Username}, check for a missing jar in your jmeter 'search_paths' and 'plugin_dependency_paths' properties
java.lang.ClassNotFoundException: package.SseSampler
at java.net.URLClassLoader.findClass(URLClassLoader.java:445) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:467) ~[?:?]
at org.apache.jmeter.protocol.java.config.gui.JavaConfigGui.classOk(JavaConfigGui.java:272) ~[ApacheJMeter_java.jar:5.5]
at org.apache.jmeter.protocol.java.config.gui.JavaConfigGui.configure(JavaConfigGui.java:260) ~[ApacheJMeter_java.jar:5.5]
at org.apache.jmeter.protocol.java.control.gui.JavaTestSamplerGui.configure(JavaTestSamplerGui.java:89) ~[ApacheJMeter_java.jar:5.5]
at org.apache.jmeter.gui.GuiPackage.refreshCurrentGui(GuiPackage.java:468) ~[ApacheJMeter_core.jar:5.5]
at org.apache.jmeter.gui.GuiPackage.updateCurrentGui(GuiPackage.java:452) ~[ApacheJMeter_core.jar:5.5]
at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:79) ~[ApacheJMeter_core.jar:5.5]
at org.apache.jmeter.gui.action.ActionRouter.doActionNow(ActionRouter.java:124) ~[ApacheJMeter_core.jar:5.5]
at org.apache.jmeter.gui.MainFrame.actionPerformed(MainFrame.java:899) ~[ApacheJMeter_core.jar:5.5]
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972) ~[?:?]
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313) ~[?:?]
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) ~[?:?]
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) ~[?:?]
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279) ~[?:?]
at com.github.weisj.darklaf.ui.button.DarkButtonListener.mouseReleased(DarkButtonListener.java:72) ~[darklaf-core-2.7.3.jar:2.7.3]
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297) ~[?:?]
at java.awt.Component.processMouseEvent(Component.java:6626) ~[?:?]
at javax.swing.JComponent.processMouseEvent(JComponent.java:3389) ~[?:?]
at java.awt.Component.processEvent(Component.java:6391) ~[?:?]
at java.awt.Container.processEvent(Container.java:2266) ~[?:?]
at java.awt.Component.dispatchEventImpl(Component.java:5001) ~[?:?]
at java.awt.Container.dispatchEventImpl(Container.java:2324) ~[?:?]
at java.awt.Component.dispatchEvent(Component.java:4833) ~[?:?]
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948) ~[?:?]
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575) ~[?:?]
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516) ~[?:?]
at java.awt.Container.dispatchEventImpl(Container.java:2310) ~[?:?]
at java.awt.Window.dispatchEventImpl(Window.java:2780) ~[?:?]
at java.awt.Component.dispatchEvent(Component.java:4833) ~[?:?]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773) ~[?:?]
at java.awt.EventQueue$4.run(EventQueue.java:722) ~[?:?]
at java.awt.EventQueue$4.run(EventQueue.java:716) ~[?:?]
at java.security.AccessController.doPrivileged(AccessController.java:399) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) ~[?:?]
at java.awt.EventQueue$5.run(EventQueue.java:746) ~[?:?]
at java.awt.EventQueue$5.run(EventQueue.java:744) ~[?:?]
at java.security.AccessController.doPrivileged(AccessController.java:399) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) ~[?:?]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:743) ~[?:?]
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) ~[?:?]
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) ~[?:?]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) ~[?:?]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) ~[?:?]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) ~[?:?]
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) ~[?:?]
Everything worked in 5.4.1 version, but for some reason it cannot run right now on my machine, so I would like to try use newest one.
Env:
- Windows 10 Enterprise
- Java 11 openjdk version "11.0.14" 2022-01-18 LTS
Solution
- Put your .jar to "lib/ext" folder of your JMeter installation
- Restart JMeter to pick it up
- No other actions are required, i.e. don't amend Classpath, don't include it in Test Plan, etc.
If you want reference implementation you can take a look at RSAEncrypt.java and RSADecrypt.java
If you follow installation instructions from Beanshell vs. JSR223 vs. Java For JMeter: Complete Showdown article you should see the next 2 guys there:
If you see them - then there is something wrong with your jar, take a look at jmeter.log file and see if there are any suspicious entries there.
If you don't see them - then something is wrong with your JMeter installation, it's better to reinstall it from scratch.
Answered By - Dmitri T
Answer Checked By - David Goodson (JavaFixing Volunteer)