0
votes

I need to run JMeter test plan on the server and I get the error at run time: unable to resolve class org.apache.commons.lang.RandomStringUtils at line import org.apache.commons.lang.RandomStringUtils;.

As I understand some plugin is missing on the server JMeter location. After unsuccessfully web searching for that problem pertaining to JMeter specifically, I've found page https://commons.apache.org/proper/commons-lang/javadocs/api-3.9/org/apache/commons/lang3/RandomStringUtils.html.

I've downloaded commons-lang package from apache site, it contains files commons-lang*.jar. In lib folder of JMeter there are also files of jar type, on workstation where test plan works I've found commons-lang3-3.8.1.jar jar in bin folder of jmeter. Running jar -tf shows it has RandomStringUtils class. I copied the file to the server to its lib folder. But the error persisted.

I've read Java jars unable to resolve class but I assume jmeter looks in lib for plugins jar files as there are many files there already.

What else could be the problem? Should I register plugin somehow? From my experience just copying jar to lib/ext was enough. JMeter version is same: 5.1.1.

2

2 Answers

0
votes

I noted in the output of jar that I've found another class (also apparent on description on apache page): org/apache/commons/lang3/RandomStringUtils.class not org/apache/commons/lang/RandomStringUtils.class.

The below command helped find correct jar on local station: echo;find /usr/local/javaapps/apache-jmeter-5.1.1/lib -name *.jar -exec sh -c "jar -tf {} | grep RandomString && echo && ls {} && echo && echo" \;

It "happened" to be jmeter-plugins-manager-1.3.jar. Why such strange (IMHO) location I do not know, but copying it to the server solved the issue. If somebody has knowledge on why that file contained that class, please share in comments.

0
votes

The problem is that jmeter-plugins-manager-1.3.jar is installed because jmeter-pluigns-manager contains the StringUtils Class. There are many other importable classes.

This can be seen by unzipping the jmeter-plugins-manager-1.3.jar file.