apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.4k stars 2.1k forks source link

java.lang.ExceptionInInitializerError when running Junit tests from Jmeter java program #3665

Closed asfimport closed 9 years ago

asfimport commented 9 years ago

Vincent (Bug 58316):

  1. I have a Junit test while send web request and get the response
  2. I have another java project in which I call Jmeter run api call for this Junit test. I'm getting the error java.lang.ExceptionInInitializerError. Here is the stack trace. Anu help is much appreciated. Thanks in advance

    java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.apache.jmeter.engine.util.CompoundVariable.<clinit>(CompoundVariable.java:76) at org.apache.jmeter.engine.util.ValueReplacer.<init>(ValueReplacer.java:44) at org.apache.jmeter.engine.PreCompiler.<init>(PreCompiler.java:52) at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:315) at Tests.RatTest.test(RatTest.java:94) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.NullPointerException at org.apache.jmeter.util.JMeterUtils.getResStringDefault(JMeterUtils.java:507) at org.apache.jmeter.util.JMeterUtils.getResStringDefault(JMeterUtils.java:488) at org.apache.jmeter.util.JMeterUtils.getResString(JMeterUtils.java:441) at org.apache.jmeter.functions.BeanShell.<clinit>(BeanShell.java:51) ... 32 more

Here is the console output from Eclipse:-

WARN 2015-09-02 19:55:45.481 [jmeter.u] (): Unexpected value set for boolean property:'server.exitaftertest', defaulting to:false WARN 2015-09-02 19:55:45.504 [jmeter.u] (): Unexpected value set for boolean property:'jmeterengine.startlistenerslater', defaulting to:true INFO 2015-09-02 19:55:45.504 [jmeter.e] (): Listeners will be started after enabling running version INFO 2015-09-02 19:55:45.504 [jmeter.e] (): To revert to the earlier behaviour, define jmeterengine.startlistenerslater=false WARN 2015-09-02 19:55:45.504 [jmeter.u] (): Unexpected value set for boolean property:'jmeterengine.remote.system.exit', defaulting to:false WARN 2015-09-02 19:55:45.504 [jmeter.u] (): Unexpected value set for boolean property:'jmeterengine.stopfail.system.exit', defaulting to:true WARN 2015-09-02 19:55:45.505 [jmeter.u] (): Unexpected value set for boolean property:'jmeterengine.force.system.exit', defaulting to:false Jmeter Home : c:/Tools/apache-jmeter-2.13 Jmeter Bin : c:/Tools/apache-jmeter-2.13\bin Search Path = c:/Tools/apache-jmeter-2.13/lib/ext INFO 2015-09-02 19:55:47.888 [jmeter.e] (): Running the test! INFO 2015-09-02 19:55:47.893 [jmeter.s] (): List of sample_variables: [] INFO 2015-09-02 19:55:47.893 [jmeter.s] (): List of sample_variables: [] INFO 2015-09-02 19:55:47.901 [jmeter.e] (): Note: Function class names must contain the string: '.functions.' INFO 2015-09-02 19:55:47.901 [jmeter.e] (): Note: Function class names must not contain the string: '.gui.' DEBug 2015-09-02 19:55:47.905 [jorphan.] (): searchPathsOrJars : [c:/Tools/apache-jmeter-2.13/lib/ext] DEBug 2015-09-02 19:55:47.905 [jorphan.] (): superclass : [interface org.apache.jmeter.functions.Function] DEBug 2015-09-02 19:55:47.905 [jorphan.] (): innerClasses : true annotations: false DEBug 2015-09-02 19:55:47.905 [jorphan.] (): contains: .functions. notContains: .gui. DEBug 2015-09-02 19:55:47.907 [jorphan.] (): Classpath = C:\Work\GuideMe\Sikuli\JMeter\bin;C:\Tools\apache-jmeter-2.13\lib\avalon-framework-4.1.4.jar;C:\Tools\apache-jmeter-2.13\lib\bsf-2.4.0.jar;C:\Tools\apache-jmeter-2.13\lib\bsh-2.0b5.jar;C:\Tools\apache-jmeter-2.13\lib\bshclient.jar;C:\Tools\apache-jmeter-2.13\lib\commons-codec-1.10.jar;C:\Tools\apache-jmeter-2.13\lib\commons-collections-3.2.1.jar;C:\Tools\apache-jmeter-2.13\lib\commons-httpclient-3.1.jar;C:\Tools\apache-jmeter-2.13\lib\commons-io-2.4.jar;C:\Tools\apache-jmeter-2.13\lib\commons-jexl-1.1.jar;C:\Tools\apache-jmeter-2.13\lib\commons-jexl-2.1.1.jar;C:\Tools\apache-jmeter-2.13\lib\commons-lang3-3.3.2.jar;C:\Tools\apache-jmeter-2.13\lib\commons-logging-1.2.jar;C:\Tools\apache-jmeter-2.13\lib\commons-math3-3.4.1.jar;C:\Tools\apache-jmeter-2.13\lib\commons-net-3.3.jar;C:\Tools\apache-jmeter-2.13\lib\commons-pool2-2.3.jar;C:\Tools\apache-jmeter-2.13\lib\dnsjava-2.1.7.jar;C:\Tools\apache-jmeter-2.13\lib\excalibur-datasource-2.1.jar;C:\Tools\apache-jmeter-2.13\lib\excalibur-instrument-1.0.jar;C:\Tools\apache-jmeter-2.13\lib\excalibur-logger-1.1.jar;C:\Tools\apache-jmeter-2.13\lib\excalibur-pool-api-2.1.jar;C:\Tools\apache-jmeter-2.13\lib\excalibur-pool-impl-2.1.jar;C:\Tools\apache-jmeter-2.13\lib\excalibur-pool-instrumented-2.1.jar;C:\Tools\apache-jmeter-2.13\lib\geronimo-jms_1.1_spec-1.1.1.jar;C:\Tools\apache-jmeter-2.13\lib\htmllexer-2.1.jar;C:\Tools\apache-jmeter-2.13\lib\htmlparser-2.1.jar;C:\Tools\apache-jmeter-2.13\lib\httpclient-4.2.6.jar;C:\Tools\apache-jmeter-2.13\lib\httpcore-4.2.5.jar;C:\Tools\apache-jmeter-2.13\lib\httpmime-4.2.6.jar;C:\Tools\apache-jmeter-2.13\lib\jcharts-0.7.5.jar;C:\Tools\apache-jmeter-2.13\lib\jdom-1.1.3.jar;C:\Tools\apache-jmeter-2.13\lib\jodd-core-3.6.4.jar;C:\Tools\apache-jmeter-2.13\lib\jodd-lagarto-3.6.4.jar;C:\Tools\apache-jmeter-2.13\lib\jodd-log-3.6.4.jar;C:\Tools\apache-jmeter-2.13\lib\jorphan.jar;C:\Tools\apache-jmeter-2.13\lib\jsoup-1.8.1.jar;C:\Tools\apache-jmeter-2.13\lib\jtidy-r938.jar;C:\Tools\apache-jmeter-2.13\lib\junit-4.12.jar;C:\Tools\apache-jmeter-2.13\lib\logkit-2.0.jar;C:\Tools\apache-jmeter-2.13\lib\mail-1.5.0-b01.jar;C:\Tools\apache-jmeter-2.13\lib\mongo-java-driver-2.11.3.jar;C:\Tools\apache-jmeter-2.13\lib\oro-2.0.8.jar;C:\Tools\apache-jmeter-2.13\lib\rhino-1.7R5.jar;C:\Tools\apache-jmeter-2.13\lib\rsyntaxtextarea-2.5.6.jar;C:\Tools\apache-jmeter-2.13\lib\serializer-2.7.2.jar;C:\Tools\apache-jmeter-2.13\lib\slf4j-api-1.7.10.jar;C:\Tools\apache-jmeter-2.13\lib\slf4j-nop-1.7.10.jar;C:\Tools\apache-jmeter-2.13\lib\soap-2.3.1.jar;C:\Tools\apache-jmeter-2.13\lib\tika-core-1.7.jar;C:\Tools\apache-jmeter-2.13\lib\tika-parsers-1.7.jar;C:\Tools\apache-jmeter-2.13\lib\xalan-2.7.2.jar;C:\Tools\apache-jmeter-2.13\lib\xercesImpl-2.11.0.jar;C:\Tools\apache-jmeter-2.13\lib\xml-apis-1.4.01.jar;C:\Tools\apache-jmeter-2.13\lib\xmlgraphics-commons-1.5.jar;C:\Tools\apache-jmeter-2.13\lib\xmlpull-1.1.3.1.jar;C:\Tools\apache-jmeter-2.13\lib\xpp3_min-1.1.4c.jar;C:\Tools\apache-jmeter-2.13\lib\xstream-1.4.8.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_components.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_core.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_ftp.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_functions.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_http.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_java.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_jdbc.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_jms.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_junit.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_ldap.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_mail.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_mongodb.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_monitors.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_native.jar;C:\Tools\apache-jmeter-2.13\lib\ext\ApacheJMeter_tcp.jar;C:\Tools\apache-jmeter-2.13\lib\hamcrest-all-1.0.jar;/E:/Eclipse/eclipse/configuration/org.eclipse.osgi/362/0/.cp/;/E:/Eclipse/eclipse/configuration/org.eclipse.osgi/361/0/.cp/ DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[0] : groovy-all-1.8.0.jar DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[1] : ApacheJMeter_tcp.jar DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[2] : c:/Tools/apache-jmeter-2.13/lib/ext DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[3] : ApacheJMeter_ftp.jar DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[4] : ApacheJMeter_junit.jar DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[5] : hamcrest-all-1.0.jar DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[6] : ApacheJMeter_java.jar DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[7] : ApacheJMeter_mail.jar DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[8] : ApacheJMeter_mongodb.jar DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[9] : ApacheJMeter_functions.jar DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[10] : ApacheJMeter_jdbc.jar DEBug 2015-09-02 19:55:47.907 [jorphan.] (): strPathsOrJars[11] : ApacheJMeter_components.jar DEBug 2015-09-02 19:55:47.908 [jorphan.] (): strPathsOrJars[12] : com.jayway.rest-assured-osgi-1.6.2.jar DEBug 2015-09-02 19:55:47.908 [jorphan.] (): strPathsOrJars[13] : ApacheJMeter_native.jar DEBug 2015-09-02 19:55:47.908 [jorphan.] (): strPathsOrJars[14] : ApacheJMeter_http.jar DEBug 2015-09-02 19:55:47.908 [jorphan.] (): strPathsOrJars[15] : ApacheJMeter_core.jar DEBug 2015-09-02 19:55:47.908 [jorphan.] (): strPathsOrJars[16] : ApacheJMeter_monitors.jar DEBug 2015-09-02 19:55:47.908 [jorphan.] (): strPathsOrJars[17] : ApacheJMeter_jms.jar DEBug 2015-09-02 19:55:47.908 [jorphan.] (): strPathsOrJars[18] : ApacheJMeter_ldap.jar DEBug 2015-09-02 19:55:47.908 [jorphan.] (): Did not find: C:/Work/GuideMe/Sikuli/JMeter/bin DEBug 2015-09-02 19:55:47.908 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/avalon-framework-4.1.4.jar DEBug 2015-09-02 19:55:47.908 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/bsf-2.4.0.jar DEBug 2015-09-02 19:55:47.908 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/bsh-2.0b5.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/bshclient.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/commons-codec-1.10.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/commons-collections-3.2.1.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/commons-httpclient-3.1.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/commons-io-2.4.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/commons-jexl-1.1.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/commons-jexl-2.1.1.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/commons-lang3-3.3.2.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/commons-logging-1.2.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/commons-math3-3.4.1.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/commons-net-3.3.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/commons-pool2-2.3.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/dnsjava-2.1.7.jar DEBug 2015-09-02 19:55:47.909 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/excalibur-datasource-2.1.jar DEBug 2015-09-02 19:55:47.910 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/excalibur-instrument-1.0.jar DEBug 2015-09-02 19:55:47.910 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/excalibur-logger-1.1.jar DEBug 2015-09-02 19:55:47.910 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/excalibur-pool-api-2.1.jar DEBug 2015-09-02 19:55:47.910 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/excalibur-pool-impl-2.1.jar DEBug 2015-09-02 19:55:47.910 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/excalibur-pool-instrumented-2.1.jar DEBug 2015-09-02 19:55:47.910 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/geronimo-jms_1.1_spec-1.1.1.jar DEBug 2015-09-02 19:55:47.910 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/htmllexer-2.1.jar DEBug 2015-09-02 19:55:47.910 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/htmlparser-2.1.jar DEBug 2015-09-02 19:55:47.910 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/httpclient-4.2.6.jar DEBug 2015-09-02 19:55:47.910 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/httpcore-4.2.5.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/httpmime-4.2.6.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/jcharts-0.7.5.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/jdom-1.1.3.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/jodd-core-3.6.4.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/jodd-lagarto-3.6.4.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/jodd-log-3.6.4.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/jorphan.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/jsoup-1.8.1.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/jtidy-r938.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/junit-4.12.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/logkit-2.0.jar DEBug 2015-09-02 19:55:47.912 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/mail-1.5.0-b01.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/mongo-java-driver-2.11.3.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/oro-2.0.8.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/rhino-1.7R5.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/rsyntaxtextarea-2.5.6.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/serializer-2.7.2.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/slf4j-api-1.7.10.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/slf4j-nop-1.7.10.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/soap-2.3.1.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/tika-core-1.7.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/tika-parsers-1.7.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/xalan-2.7.2.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/xercesImpl-2.11.0.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/xml-apis-1.4.01.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/xmlgraphics-commons-1.5.jar DEBug 2015-09-02 19:55:47.913 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/xmlpull-1.1.3.1.jar DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/xpp3_min-1.1.4c.jar DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Did not find: C:/Tools/apache-jmeter-2.13/lib/xstream-1.4.8.jar DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_components.jar found at 11 DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_core.jar found at 15 DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_ftp.jar found at 3 DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_functions.jar found at 9 DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_http.jar found at 14 DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_java.jar found at 6 DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_jdbc.jar found at 10 DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_jms.jar found at 17 DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_junit.jar found at 4 DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_ldap.jar found at 18 DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_mail.jar found at 7 DEBug 2015-09-02 19:55:47.914 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_mongodb.jar found at 8 DEBug 2015-09-02 19:55:47.915 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_monitors.jar found at 16 DEBug 2015-09-02 19:55:47.915 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_native.jar found at 13 DEBug 2015-09-02 19:55:47.915 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_tcp.jar found at 1 DEBug 2015-09-02 19:55:47.915 [jorphan.] (): Adding C:/Tools/apache-jmeter-2.13/lib/hamcrest-all-1.0.jar found at 5 DEBug 2015-09-02 19:55:47.915 [jorphan.] (): Did not find: /E:/Eclipse/eclipse/configuration/org.eclipse.osgi/362/0/.cp DEBug 2015-09-02 19:55:47.915 [jorphan.] (): Did not find: /E:/Eclipse/eclipse/configuration/org.eclipse.osgi/361/0/.cp DEBug 2015-09-02 19:55:47.915 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_components.jar DEBug 2015-09-02 19:55:47.915 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_core.jar DEBug 2015-09-02 19:55:47.915 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_ftp.jar DEBug 2015-09-02 19:55:47.915 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_functions.jar DEBug 2015-09-02 19:55:47.915 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_http.jar DEBug 2015-09-02 19:55:47.915 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_java.jar DEBug 2015-09-02 19:55:47.915 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_jdbc.jar DEBug 2015-09-02 19:55:47.915 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_jms.jar DEBug 2015-09-02 19:55:47.915 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_junit.jar DEBug 2015-09-02 19:55:47.916 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_ldap.jar DEBug 2015-09-02 19:55:47.916 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_mail.jar DEBug 2015-09-02 19:55:47.916 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_mongodb.jar DEBug 2015-09-02 19:55:47.916 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_monitors.jar DEBug 2015-09-02 19:55:47.916 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_native.jar DEBug 2015-09-02 19:55:47.916 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/ext/ApacheJMeter_tcp.jar DEBug 2015-09-02 19:55:47.916 [jorphan.] (): listPaths : C:/Tools/apache-jmeter-2.13/lib/hamcrest-all-1.0.jar DEBug 2015-09-02 19:55:47.950 [jorphan.] (): listClasses.size()=37 DEBug 2015-09-02 19:55:47.950 [jorphan.] (): listClasses : org.apache.jmeter.functions.BeanShell DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.CSVRead DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.CharFunction DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.EscapeHtml DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.EscapeOroRegexpChars DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.EvalFunction DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.EvalVarFunction DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.FileToString DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.IntSum DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.IterationCounter DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.JavaScript DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.Jexl2Function DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.JexlFunction DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.LogFunction DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.LogFunction2 DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.LongSum DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.MachineIP DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.MachineName DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.Property DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.Property2 DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.Random DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.RandomString DEBug 2015-09-02 19:55:47.951 [jorphan.] (): listClasses : org.apache.jmeter.functions.RegexFunction DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.SamplerName DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.SetProperty DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.SplitFunction DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.StringFromFile DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.TestPlanName DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.ThreadNumber DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.TimeFunction DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.UnEscape DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.UnEscapeHtml DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.UrlDecode DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.UrlEncode DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.Uuid DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.Variable DEBug 2015-09-02 19:55:47.952 [jorphan.] (): listClasses : org.apache.jmeter.functions.XPath

Severity: normal OS: All Resolution: WORKSFORME

asfimport commented 9 years ago

Vincent (migrated from Bugzilla):

  1. I have a Junit test which sends web request and get the response
  2. I have another java project in which, I call Jmeter run method, to run this Junit test. I'm getting the error java.lang.ExceptionInInitializerError. Here is the stack trace. Anu help is much appreciated. Thanks in advance:

Code used:-

package Tests;

import static org.junit.Assert.*;

import org.apache.jmeter.control.LoopController; import org.apache.jmeter.engine.StandardJMeterEngine; import org.apache.jmeter.protocol.http.sampler.HTTPSampler; import org.apache.jmeter.protocol.java.sampler.JUnitSampler; import org.apache.jmeter.reporters.ResultCollector; import org.apache.jmeter.reporters.Summariser; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.testelement.TestPlan; import org.apache.jmeter.threads.SetupThreadGroup; import org.apache.jmeter.util.JMeterUtils; import org.apache.jorphan.collections.HashTree; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test;

public class RatTest {

@BeforeClass
public static void setUpBeforeClass() throws Exception {
}

@AfterClass
public static void tearDownAfterClass() throws Exception {
}

@Test
public void test() {
     StandardJMeterEngine jm = new StandardJMeterEngine();
        // jmeter.properties
        JMeterUtils.loadJMeterProperties("c:/Tools/apache-jmeter-2.13/bin/jmeter.properties");
        JMeterUtils.setJMeterHome("c:/Tools/apache-jmeter-2.13");

        System.out.println("Jmeter Home : "+JMeterUtils.getJMeterHome());
        System.out.println("Jmeter Bin : "+JMeterUtils.getJMeterBinDir());
        String[] s= JMeterUtils.getSearchPaths();
        for(String s1 : JMeterUtils.getSearchPaths())
        {
        System.out.println("Search Path = "+s1);
        }

        HashTree hashTree = new HashTree();     

        // HTTP Sampler
     /*   HTTPSampler httpSampler = new HTTPSampler();
        httpSampler.setDomain("www.google.com");
        httpSampler.setPort(80);
        httpSampler.setPath("/");
        httpSampler.setMethod("GET");  */      

        JUnitSampler junitSampler = new JUnitSampler();
        junitSampler.setClassname("Ratable.Service.RestAssuredTests");
        junitSampler.setMethod("testFindUsingGroovyClosure");

        // Loop Controller
        TestElement loopCtrl = new LoopController();
        ((LoopController)loopCtrl).setLoops(1);
        ((LoopController)loopCtrl).addTestElement(junitSampler);
        ((LoopController)loopCtrl).setFirst(true);

        // Thread Group
        SetupThreadGroup threadGroup = new SetupThreadGroup();
        threadGroup.setNumThreads(1);
        threadGroup.setRampUp(1);
        threadGroup.setSamplerController((LoopController)loopCtrl);

        // Test plan
        TestPlan testPlan = new TestPlan("MY TEST PLAN");

        hashTree.add("testPlan", testPlan);
        hashTree.add("loopCtrl", loopCtrl);
        hashTree.add("threadGroup", threadGroup);
        hashTree.add("junitSampler", junitSampler);       

        jm.configure(hashTree);

        //log results

        Summariser summer = null;
        String summariserName = JMeterUtils.getPropDefault("summariser.name", "summary");//$NON-NLS-1$
        if (summariserName.length() &gt; 0) {
            summer = new Summariser(summariserName);
        }

        String logFile = "c:/outfile.jtl";
        ResultCollector logger = new ResultCollector(summer);
        logger.setFilename(logFile);
        hashTree.add(hashTree.getArray()[0], logger);

        jm.run();
        jm.exit();

}

}

asfimport commented 9 years ago

@pmouawad (migrated from Bugzilla): Could you provide the jmeter.log file and also a simple Test Java Project that does not use your classes in JMeter plan.

Currently your code does not work for me. I changed it a bit to this and it seems to work, to use it set -Djmeter.home=<path to jmeter 2.13> public static void main(String[] argv) throws Exception {

    File jmeterHome = new File(System.getProperty("jmeter.home"));
    String slash = System.getProperty("file.separator");

    if (jmeterHome.exists()) {
        File jmeterProperties = new File(jmeterHome.getPath() + slash + "bin" + slash + "jmeter.properties");
        if (jmeterProperties.exists()) {
            StandardJMeterEngine jm = new StandardJMeterEngine();
            // jmeter.properties
            JMeterUtils.setJMeterHome(jmeterHome.getPath());
            JMeterUtils.loadJMeterProperties(jmeterProperties.getPath());
            JMeterUtils.initLogging();// you can comment this line out to see extra log messages of i.e. DEBUG level
            JMeterUtils.initLocale();

            System.out.println("Jmeter Home : "+JMeterUtils.getJMeterHome());
            System.out.println("Jmeter Bin : "+JMeterUtils.getJMeterBinDir());
            String[] s= JMeterUtils.getSearchPaths();
            for(String s1 : JMeterUtils.getSearchPaths())
            {
            System.out.println("Search Path = "+s1);
            }

            HashTree testPlanTree = new HashTree();     

            // HTTP Sampler
         /*   HTTPSampler httpSampler = new HTTPSampler();
            httpSampler.setDomain("www.google.com");
            httpSampler.setPort(80);
            httpSampler.setPath("/");
            httpSampler.setMethod("GET");  */      

            JUnitSampler junitSampler = new JUnitSampler();
            junitSampler.setClassname("Ratable.Service.RestAssuredTests");
            junitSampler.setMethod("testFindUsingGroovyClosure");

            // Loop Controller
            TestElement loopCtrl = new LoopController();
            ((LoopController)loopCtrl).setLoops(1);
            ((LoopController)loopCtrl).addTestElement(junitSampler);
            ((LoopController)loopCtrl).setFirst(true);

            // Thread Group
            SetupThreadGroup threadGroup = new SetupThreadGroup();
            threadGroup.setNumThreads(1);
            threadGroup.setRampUp(1);
            threadGroup.setSamplerController((LoopController)loopCtrl);

            // Test plan
            TestPlan testPlan = new TestPlan("MY TEST PLAN");
            testPlan.setProperty(TestElement.TEST_CLASS, TestPlan.class.getName());
            testPlan.setProperty(TestElement.GUI_CLASS, TestPlanGui.class.getName());
            testPlan.setUserDefinedVariables((Arguments) new ArgumentsPanel().createTestElement());

            testPlanTree.add( testPlan);
            HashTree threadGroupHashTree = testPlanTree.add(testPlan, threadGroup);

            HashTree ht = threadGroupHashTree.add( loopCtrl);
            //testPlanTree.add("threadGroup", threadGroup);

            ht.add( junitSampler);       

            //log results

            Summariser summer = null;
            String summariserName = JMeterUtils.getPropDefault("summariser.name", "summary");//$NON-NLS-1$
            if (summariserName.length() &gt; 0) {
                summer = new Summariser(summariserName);
            }

            String logFile = "/data/jmeter/jmeters/outfile.jtl";
            ResultCollector logger = new ResultCollector(summer);
            logger.setFilename(logFile);
            testPlanTree.add(testPlanTree.getArray()[0], logger);
            jm.configure(testPlanTree);
            jm.run();
            System.exit(0);

        }
    }

    System.err.println("jmeter.home property is not set or pointing to incorrect location");
    System.exit(1);

}