I have described issue in details at https://stackoverflow.com/questions/46429778/when-running-jmeter-script-from-java-functions-and-properties-do-not-work/ It has sample code. Th eproblem I have found is that JMeter wants to have a library in classpath with exact name of "ApacheJMeter_functions.jar" it can't be "ApacheJMeter_functions-3.3.jar" even if the files are binary equal. This means that I can't load "ApacheJMeter_functions.jar" from Maven which is very inconvenient and causes additional issues. Please change behavior so that "ApacheJMeter_functions*.jar" worked as well.
See my answer on SO. For information , to ask question use jmeter mailing list: - http://jmeter.apache.org/mail2.html Closing as WORKSFORME. If issue persists , please reopen. Regards
Jmeter itself runs. The funstions do not work. For example, if you set "${__P(threadsNum,1)}" as a value for "Number of Threads" for thread group you will see in the log "starting 0 threads". Functions start to work only if jar is named exactly ApacheJMeter_functions.jar this means that I can't use this jar from Maven.
Did you try the solution described in my SO answer ? There is an issue in your code anyway. Thank you
Created attachment 35389 [details] Demo project
Sorry for confusion. I have copied jmeter.properties file to teh other location. So it has nothing to do with the behavior of the code. I have attached demo project. Unzip it, edit pom.xml and src\main\java\mytst\tst1\App.java to specify correct JMeter home. After this run "mvn package". In the log you will see that everything is fine and one of the log lines will be following: -- Starting thread group... number=1 threads=2 ramp-up=1 perThread=500.0 delayedStart=false -- Now go back to pom.xml and comment out dependency to "${jmeter.home}/lib/ext/ApacheJMeter_functions.jar" and uncomment maven dependency which has to be downloaded from Maven repo. Run "mvn package" again. In the logs you will see following -- Starting thread group... number=1 threads=0 ramp-up=1 perThread=Infinity delayedStart=false -- As you see the difference is that with "ApacheJMeter_functions.jar" it was "threads=2" but with "ApacheJMeter_functions-3.3.jar" you get "threads=0". But two jars are binary equal(I have checked this) and the only difference is their name.In the jmeter script I am setting "ThreadGroup.num_threads" to ${__P(xxx,2)} which is function.
Hello, Thanks for the project. It helped me understand your problem. I notice: - Code works if App is ran as a Main application - Code works if AppTest is ran from Eclipse - Code fails when ran through mvn clean install The failure is due to this code: - https://github.com/apache/jmeter/blob/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java#L335
I think the failure is due to the project setup. The POM mixes system and non-system JMeter dependencies. No wonder JMeter has problems with the classpath.
The mix is just to highlight the bug. When only using non system dependencies, test fails. IMO it's a jmeter issue.
(In reply to Sebb from comment #7) > I think the failure is due to the project setup. > > The POM mixes system and non-system JMeter dependencies. > No wonder JMeter has problems with the classpath. This has nothing to do with the bug. You hav to use "system" scope if you want to add jar called "ApacheJMeter_functions.jar". This is definitely bug. Try it yourself and remove this. That's the entire point of this issue.
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4506