• Uncategorized

About java : Cant-create-CSV-file-in-Linux-with-JMeterPluginsCMDsh-after-updating-log4j-files-to-217

Question Detail

A sample command is –

Jmeter-master:/tmp$ JMeterPluginsCMD.sh –generate-csv /tmp/test.csv –input-jtl /tmp/jmeter.jtl –plugin-type AggregateReport

This works in Windows with the .bat file after updating the log4j files, but not with the .sh in Linux. I get the following error. Anyone else encountering this? BTW – It was working fine over a week ago in Linux, but stopped working at some point and don’t recall making any breaking changes.

ERROR: java.lang.NoClassDefFoundError: kg/apc/logging/LoggingUtils
*** Problem’s technical details go below *** Home directory was detected as: /opt/apache-jmeter-5.0/lib Exception in thread “main”
java.lang.NoClassDefFoundError: kg/apc/logging/LoggingUtils
at kg.apc.cmdtools.ReporterTool.(ReporterTool.java:17)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at kg.apc.cmdtools.PluginsCMD.getToolInstance(PluginsCMD.java:128)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:50)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:21)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:115) Caused by: java.lang.ClassNotFoundException:
kg.apc.logging.LoggingUtils
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
… 14 more

Specific automation steps –

RUN curl -fsSL --compressed -o /tmp/jmeter.tgz https://dlcdn.apache.org//jmeter/binaries/$JMETER_VERSION.tgz \
    && tar -C /opt -xzf /tmp/jmeter.tgz \
    && rm /tmp/jmeter.tgz \
    && chmod +w /opt/$JMETER_VERSION/lib \
    && curl -fsSL --compressed -o /opt/$JMETER_VERSION/lib/jmeter-plugins-cmn-jmeter-0.7-sources.jar https://search.maven.org/classic/remotecontent?filepath=kg/apc/jmeter-plugins-cmn-jmeter/0.7/jmeter-plugins-cmn-jmeter-0.7-sources.jar \
    && curl -fsSL --compressed -o /tmp/mysql-connector.tar.gz https://downloads.mysql.com/archives/get/p/3/file/mysql-connector-java-6.0.3.tar.gz \
    && tar -C /opt/$JMETER_VERSION/lib -xzvf /tmp/mysql-connector.tar.gz --strip-components 1 mysql-connector-java-6.0.3/mysql-connector-java-6.0.3-bin.jar \
    && rm /tmp/mysql-connector.tar.gz \
    && curl -fsSL --compressed -o /opt/$JMETER_VERSION/lib/ext/jmeter-plugins-manager.jar https://jmeter-plugins.org/get \
    && curl -fsSL --compressed -o /opt/$JMETER_VERSION/lib/cmdrunner-$CMDRUNNER_VERSION.jar https://repo1.maven.org/maven2/kg/apc/cmdrunner/$CMDRUNNER_VERSION/cmdrunner-$CMDRUNNER_VERSION.jar \
    && java -cp /opt/$JMETER_VERSION/lib/ext/jmeter-plugins-manager.jar org.jmeterplugins.repository.PluginManagerCMDInstaller \
    && /opt/$JMETER_VERSION/bin/PluginsManagerCMD.sh install-all-except jpgc-hadoop,jpgc-oauth,ulp-jmeter-gwt-plugin,ulp-jmeter-autocorrelator-plugin,ulp-jmeter-videostreaming-plugin \
    && sleep 2 \
    && /opt/$JMETER_VERSION/bin/PluginsManagerCMD.sh status

Error trying to do JMeterPluginsCMD.sh –

2021-12-30 13:03:12,008 WARN o.j.r.Plugin: Unable to load class: nz.co.breakpoint.jmeter.vizualizers.sshmon.SSHMonCollector
java.lang.NoClassDefFoundError: kg/apc/jmeter/vizualizers/MonitoringResultsCollector
    at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:1017) ~[?:?]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) ~[?:?]
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:555) ~[?:?]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:458) ~[?:?]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:452) ~[?:?]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:451) ~[?:?]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[?:?]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
    at org.jmeterplugins.repository.Plugin.getJARPath(Plugin.java:202) [jmeter-plugins-manager.jar:?]
    at org.jmeterplugins.repository.Plugin.detectInstalledPlugin(Plugin.java:108) [jmeter-plugins-manager.jar:?]
    at org.jmeterplugins.repository.Plugin.detectInstalled(Plugin.java:97) [jmeter-plugins-manager.jar:?]
    at org.jmeterplugins.repository.PluginManager.load(PluginManager.java:86) [jmeter-plugins-manager.jar:?]
    at org.jmeterplugins.repository.PluginManager.getStaticManager(PluginManager.java:344) [jmeter-plugins-manager.jar:?]
    at org.jmeterplugins.repository.PluginManager.getAllPluginsStatus(PluginManager.java:370) [jmeter-plugins-manager.jar:?]
    at org.jmeterplugins.repository.PluginManagerCMD.processParams(PluginManagerCMD.java:72) [jmeter-plugins-manager.jar:?]
    at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:62) [cmdrunner-2.2.jar:?]
    at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:21) [cmdrunner-2.2.jar:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:115) [cmdrunner-2.2.jar:?]
Caused by: java.lang.ClassNotFoundException: kg.apc.jmeter.vizualizers.MonitoringResultsCollector
    at java.net.URLClassLoader.findClass(URLClassLoader.java:476) ~[?:?]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[?:?]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]
    ... 24 more

Question Answer

The java.lang.NoClassDefFoundError usually has something to do with the Runtime Environment Version. Try checking if both Java versions are equal.

If they aren’t equal, try updating/downgrading your version on the Linux system accordingly.

If they are equal, try checking for missing libraries.

I have no idea what do you mean by “updating log4j files to 2.17”, the error you’re getting is about missing jmeter-plugins-cmn-jmeter .jar in JMeter Classpath

If you prefer manual .jar libraries manipulation you could download the version you like the most to “lib” folder of your JMeter installation, on next JMeter restart or running the command-line graph generator tool the error should go away.

However I would recommend:

  • Orchestrating JMeter Plugins using JMeter Plugins Manager instead of doing it manually
  • Using the latest version of JMeter instead of trying to upgrade individual components

The reason I can’t create a CSV file is because that is done using JMeterPluginsCMD.sh, which doesn’t exist. The command that is supposed to create the JMeterPluginsCMD.sh and JMeterPluginsCMD.bat files is not working.

It’s not throwing an error that I can see, but it also is not creating the .sh or .bat files in the /bin folder.

The command that’s supposed to do that as far as I can tell is –

java -cp jmeter-plugins-manager.jar org.jmeterplugins.repository.JMeterPluginsCMDInstaller

I’m closing out this as answered and will open another issue if I can’t figure out why I’m not getting these sh and bat files.

Doing this through the GUI is not an option in this case as the test is being set-up and executed via automation.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.