JMeter Introducing Jars

Source: Internet
Author: User
Tags eval modifiers vars

Error in JMeter calling itself to write class in Jar

Write your own Java class to hit the jar package, and put the jar package into the jmeter/lib/ext/directory, start JMeter, and write a script in JMeter to invoke the class in the jar package, the following problems occur in executing the script:
Error log:

2017/01/12 17:29:17 info-jmeter.engine.standardjmeterengine:running the test! 2017/01/12 17:29:17 info-jmeter.samplers.sampleevent:list of Sample_variables: [] 2017/01/12 17:29:17 info-jmeter. Testelement. Testplan:add D:\Tool\Jmeter\apache-jmeter-3.0\lib\ext\uaastool.jar to Classpath 2017/01/12 17:29:17 Info-jmeter.gui. Util. Jmetermenubar:setrunning (true,*local*) 2017/01/12 17:29:17 info-jmeter.engine.standardjmeterengine:starting Threadgroup:1: Getchallenge 2017/01/12 17:29:17 info-jmeter.engine.standardjmeterengine:starting 1 threads for Grou 
P Getchallenge.  2017/01/12 17:29:17 Info-jmeter.engine.standardjmeterengine:thread would continue on error 2017/01/12 17:29:17 INFO- Jmeter.threads.ThreadGroup:Starting Thread Group number 1 threads 1 ramp-up 1 perthread 1000.0 delayedstart=false 2017/ 01/12 17:29:17 info-jmeter.threads.threadgroup:started Thread Group number 1 2017/01/12 17:29:17 info-jmeter.engin E.standardjmeterengine:all Thread GroUPS has been started 2017/01/12 17:29:17 info-jmeter.threads.jmeterthread:thread started:getchallenge 1-1 2017/01/ 17:29:17 Error-jmeter.util.beanshellinterpreter:error invoking BSH Method:eval sourced file:inline evaluation of : ' String challenge = vars.get ("challenge"); String response = Com.uaastool.UaasTo ...  ': Typed variable declaration:Class:com.uaastool.UaasTool.UaasTool not found in namespace 2017/01/12 17:29:17 WARN -Jmeter.modifiers.BeanShellPreProcessor:Problem in BeanShell script Org.apache.jorphan.util.JMeterException:Error Invoking BSH Method:eval sourced file:inline evaluation of: "String challenge = Vars.get (" challenge "); String response = Com.uaastool.UaasTo ...  ': Typed variable declaration:Class:com.uaastool.UaasTool.UaasTool not found in namespace 2017/01/12 17:29:17 INFO -Jmeter.threads.JMeterThread:Thread is Done:getchallenge 1-1 2017/01/12 17:29:17 info-jmeter.threads.jmeterthread: Thread Finished:getchallengE 1-1 2017/01/12 17:29:17 info-jmeter.engine.standardjmeterengine:notifying test listeners of end of Test 2017/01/12 17:29:17 info-jmeter.gui.util.jmetermenubar:setrunning (false,*local*) 2017/01/12 17:30:09 Info-jmeter.engine.stan 
Dardjmeterengine:running the test! 2017/01/12 17:30:09 info-jmeter.samplers.sampleevent:list of Sample_variables: [] 2017/01/12 17:30:09 info-jmeter. Testelement. Testplan:add D:\Tool\Jmeter\apache-jmeter-3.0\lib\ext\uaastool.jar to Classpath 2017/01/12 17:30:09 Info-jmeter.gui. Util. Jmetermenubar:setrunning (true,*local*) 2017/01/12 17:30:09 info-jmeter.engine.standardjmeterengine:starting Threadgroup:1: Getchallenge 2017/01/12 17:30:09 info-jmeter.engine.standardjmeterengine:starting 1 threads for Grou 
P Getchallenge.  2017/01/12 17:30:09 Info-jmeter.engine.standardjmeterengine:thread would continue on error 2017/01/12 17:30:09 INFO- Jmeter.threads.ThreadGroup:Starting Thread Group number 1 threads 1 ramp-up 1 PerTHread 1000.0 delayedstart=false 2017/01/12 17:30:09 info-jmeter.threads.threadgroup:started Thread Group number 1 20 17/01/12 17:30:09 Info-jmeter.engine.standardjmeterengine:all thread groups have been started 2017/01/12 17:30:09 INF O-jmeter.threads.jmeterthread:thread started:getchallenge 1-1 2017/01/12 17:30:09 error-jmeter.util.beanshellinter  Preter:error invoking BSH Method:eval sourced file:inline evaluation of: "String challenge = Vars.get (" challenge "); String response = Com.uaastool.UaasTo ...  ': Typed variable declaration:Class:com.uaastool.UaasTool.UaasTool not found in namespace 2017/01/12 17:30:09 WARN -Jmeter.modifiers.BeanShellPreProcessor:Problem in BeanShell script Org.apache.jorphan.util.JMeterException:Error Invoking BSH Method:eval sourced file:inline evaluation of: "String challenge = Vars.get (" challenge "); String response = Com.uaastool.UaasTo ... ": Typed variable Declaration:Class:com.uaastool.UaasTool.UaasTool NoT found in namespace 2017/01/12 17:30:09 Info-jmeter.threads.jmeterthread:thread was Done:getchallenge 1-1 2017/01/1 2 17:30:09 info-jmeter.threads.jmeterthread:thread finished:getchallenge 1-1 2017/01/12 17:30:09 Info-jmeter.engi Ne. Standardjmeterengine:notifying test listeners of end of Test 2017/01/12 17:30:09 Info-jmeter.gui.util.jmetermenubar:  Setrunning (false,*local*)

The cause of the above error occurs:

There is a problem with the code itself jmeter the introduction of the
package name and the class name incorrectly in your code refers to a third-party jar package that is
directly imported into the jar package
itself, and the third-party jar package that is referenced in its own code conflicts with the jar package already in the JMeter.

Workaround:

First, make sure your code runs normally in the development tool.
Second, check if the correct introduction package name and class name in JMeter are
introduced correctly in the script, check the jar package that you hit to
    pack your own code and do not break into the jar package
    the other third-party packages you refer to. Put the third-party package that your code references into the jmeter/lib/ext/directory (you need to check to see if the import jar package conflicts with the existing Jar JMeter, and you need to ensure that there are no jar package conflicts) put
    your own code into the jar package Jmeter/lib/ext /directory Restart
jmeter, run the script issue resolution again

This is the problem I encountered in using the JMeter to introduce the jar, as well as the solution. Welcome to Exchange, thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.