kulya / jmeter-gradle-plugin

Other
40 stars 27 forks source link

The GUI run by jmeterEditor can't display components from JMeter Plugins #28

Closed yangzhaoxia closed 10 years ago

yangzhaoxia commented 10 years ago

I am using 1.3.2-2.9 and I put the latest JMeter Plugins jar file JMeterPlugins-Standard.jar under build/jmeter/lib/ext. My JMeter test file includes some components from JMeterPlugins-Standard.jar saying DummySampler, and the test can be run by jmeterRun although there is 1 ClassNotFoundException exception occurred. I checked the result file, DummySampler did get executed.

......
2014/03/19 22:24:38 INFO  - jmeter.JMeter: Adding to classpath: /Users/zyang/.m2/repository/org/apache/jmeter/ApacheJMeter_core/2.9/ApacheJMeter_core-2.9.jar 
2014/03/19 22:24:38 INFO  - jmeter.JMeter: Adding to classpath: /Users/zyang/.m2/repository/org/apache/jmeter/ApacheJMeter_components/2.9/ApacheJMeter_components-2.9.jar 
2014/03/19 22:24:38 INFO  - jmeter.JMeter: Adding to classpath: /Users/zyang/Documents/projects/discussionboard/build/jmeter/lib/ext 
2014/03/19 22:24:38 INFO  - jmeter.services.FileServer: Default base='/Users/zyang/Documents/projects/discussionboard/build/jmeter' 
2014/03/19 22:24:38 INFO  - jmeter.services.FileServer: Set new base='/Users/zyang/Documents/projects/discussionboard/src/jmeter' 
2014/03/19 22:24:38 INFO  - jmeter.JMeter: Loading file: /Users/zyang/Documents/projects/discussionboard/src/jmeter/main.jmx 
2014/03/19 22:24:38 INFO  - jmeter.save.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2 
2014/03/19 22:24:38 INFO  - jmeter.save.SaveService: Using SaveService properties file encoding UTF-8 
2014/03/19 22:24:38 INFO  - jmeter.save.SaveService: Using SaveService properties file version 1050447 
2014/03/19 22:24:38 INFO  - jmeter.save.SaveService: Using SaveService properties version 2.1 
2014/03/19 22:24:38 WARN  - jmeter.save.SaveService: Bad _version - expected 2.4, found 2.1. 
2014/03/19 22:24:38 INFO  - jmeter.save.SaveService: All converter versions present and correct 
2014/03/19 22:24:38 INFO  - jmeter.protocol.http.sampler.HTTPSamplerBase: No response parsers defined: text/html only will be scanned for embedded resources 
2014/03/19 22:24:38 INFO  - jmeter.protocol.http.sampler.HTTPSamplerBase: Reuse SSL session context on subsequent iterations: true 
2014/03/19 22:24:38 INFO  - jmeter.engine.StandardJMeterEngine: Listeners will be started after enabling running version 
2014/03/19 22:24:38 INFO  - jmeter.engine.StandardJMeterEngine: To revert to the earlier behaviour, define jmeterengine.startlistenerslater=false 
2014/03/19 22:24:38 INFO  - jmeter.engine.StandardJMeterEngine: Running the test! 
2014/03/19 22:24:39 ERROR - jmeter.engine.util.CompoundVariable:  java.lang.ClassNotFoundException: kg.apc.jmeter.functions.ChooseRandom
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
    at org.apache.jmeter.engine.util.CompoundVariable.<clinit>(CompoundVariable.java:76)
    at org.apache.jmeter.engine.util.ValueReplacer.<init>(ValueReplacer.java:43)
    at org.apache.jmeter.engine.PreCompiler.<init>(PreCompiler.java:52)
    at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:304)
    at java.lang.Thread.run(Thread.java:722)

2014/03/19 22:24:39 INFO  - jmeter.JMeter: Running test (1395228279764) 

The problem is when I run jmeterEditor, why I can't see any components from JMeterPlugins. Is this an known issue? Exceptions is not only 1 like jmeterRun, instead, a lot of ClassNotFoundException as below:

...
2014/03/19 22:40:01 INFO  - jmeter.JMeter: Adding to classpath: /Users/zyang/.m2/repository/org/beanshell/bsh/2.0b5/bsh-2.0b5.jar 
2014/03/19 22:40:01 INFO  - jmeter.JMeter: Adding to classpath: /Users/zyang/.m2/repository/org/apache/jmeter/ApacheJMeter_core/2.9/ApacheJMeter_core-2.9.jar 
2014/03/19 22:40:01 INFO  - jmeter.JMeter: Adding to classpath: /Users/zyang/.m2/repository/org/apache/jmeter/ApacheJMeter_components/2.9/ApacheJMeter_components-2.9.jar 
2014/03/19 22:40:01 INFO  - jmeter.JMeter: Adding to classpath: /Users/zyang/Documents/projects/discussionboard/build/jmeter/lib/ext 
2014/03/19 22:40:01 INFO  - jmeter.JMeter: Loaded icon properties from org/apache/jmeter/images/icon.properties 
2014/03/19 22:40:03 ERROR - jmeter.engine.util.CompoundVariable:  java.lang.ClassNotFoundException: kg.apc.jmeter.functions.ChooseRandom
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
    at org.apache.jmeter.engine.util.CompoundVariable.<clinit>(CompoundVariable.java:76)
    at org.apache.jmeter.functions.gui.FunctionHelper.initializeFunctionList(FunctionHelper.java:121)
    at org.apache.jmeter.functions.gui.FunctionHelper.init(FunctionHelper.java:99)
    at org.apache.jmeter.functions.gui.FunctionHelper.<init>(FunctionHelper.java:69)
    at org.apache.jmeter.gui.action.CreateFunctionDialog.<init>(CreateFunctionDialog.java:37)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at java.lang.Class.newInstance0(Class.java:372)
    at java.lang.Class.newInstance(Class.java:325)
    at org.apache.jmeter.gui.action.ActionRouter.populateCommandMap(ActionRouter.java:274)
    at org.apache.jmeter.gui.action.ActionRouter.getInstance(ActionRouter.java:301)
    at org.apache.jmeter.JMeter.startGui(JMeter.java:229)
    at org.apache.jmeter.JMeter.start(JMeter.java:378)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.jmeter.NewDriver.main(NewDriver.java:218)

2014/03/19 22:40:03 INFO  - jmeter.gui.action.LookAndFeelCommand: Using look and feel: javax.swing.plaf.metal.MetalLookAndFeel [Metal, CrossPlatform] 
2014/03/19 22:40:04 WARN  - jmeter.gui.util.MenuFactory: Could not instantiate kg.apc.jmeter.config.DistributedTestControlGui java.lang.ClassNotFoundException: kg.apc.jmeter.config.DistributedTestControlGui
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
    at org.apache.jmeter.gui.util.MenuFactory.initializeMenus(MenuFactory.java:449)
    at org.apache.jmeter.gui.util.MenuFactory.<clinit>(MenuFactory.java:159)
    at org.apache.jmeter.control.gui.TestPlanGui.createPopupMenu(TestPlanGui.java:93)
    at org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:158)
    at org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:47)
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81)
    at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40)
    at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:682)
    at java.awt.EventQueue$3.run(EventQueue.java:680)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

2014/03/19 22:40:04 WARN  - jmeter.gui.util.MenuFactory: Could not instantiate kg.apc.jmeter.modifiers.FifoPopPreProcessorGui java.lang.ClassNotFoundException: kg.apc.jmeter.modifiers.FifoPopPreProcessorGui
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
    at org.apache.jmeter.gui.util.MenuFactory.initializeMenus(MenuFactory.java:449)
    at org.apache.jmeter.gui.util.MenuFactory.<clinit>(MenuFactory.java:159)
    at org.apache.jmeter.control.gui.TestPlanGui.createPopupMenu(TestPlanGui.java:93)
    at org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:158)
    at org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:47)
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81)
    at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40)
    at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:682)
    at java.awt.EventQueue$3.run(EventQueue.java:680)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
......

I do have the JMeterPlugins Jar file under lib/ext:

zyangmbp2:ext zyang$ cd /Users/zyang/Documents/projects/discussionboard/build/jmeter/lib/ext |ls
JMeterPlugins-Standard.jar

Is this a defect of gradle jmeter plugin?

kulya commented 10 years ago

Actually if you want to use some external library for jmeter plugin you must put it to dependency. Can you please add jmeterplugins-standard.jar as gradle dependency and try to rerun jmeter editor task?

yangzhaoxia commented 10 years ago

I tried as below, still can't see the components from JMeter-pugins.

apply plugin: 'jmeter'
apply plugin: 'eclipse'

    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath "com.github.kulya:jmeter-gradle-plugin:1.3.2-2.9" 
            classpath "kg.apc:jmeter-plugins:1.1.3"  
          }
    }

jmeterRun.configure {
    jmeterTestFiles = [file("src/jmeter/main.jmx")]
    jmeterPropertyFile = file("src/jmeter/properties/jmeter.properties")
    enableReports = "true"
    reportDir = file ("build/jmeter-report")
}

jmeterEditor.configure {
  jmeterPropertyFile = file("src/jmeter/properties/jmeter.properties")
}
yangzhaoxia commented 10 years ago

Close it, because jmeterPluginJars can help specify the plugins included in the classpath. buildscript { repositories { mavenCentral() } dependencies { ... classpath "kg.apc:jmeter-plugins:1.1.3" classpath "kg.apc:jmeter-plugins-standard:1.1.3" } }

jmeterEditor.configure { jmeterPluginJars = ["jmeter-plugins-1.1.3.jar","jmeter-plugins-standard-1.1.3.jar"] jmeterPropertyFile = file("build/jmeter/bin/jmeter.properties") }

philipbannon commented 10 years ago

@yangzhaoxia

Hi, I'm having a very similar issue. How did you get this working? From what I can see the jmeter plugins (version 1.1.3) don't work with JMeter 2.9.

Below is my build.gradle:

apply plugin: 'java'
apply plugin: 'jmeter'

sourceCompatibility = 1.5
version = '1.0'

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    //This JMeter plugin source code build depends on JMeter2.9 version.
    compile 'org.apache.jmeter:ApacheJMeter_core:2.11'
    compile 'org.apache.jmeter:ApacheJMeter_components:2.11'
    compile 'org.apache.jmeter:ApacheJMeter_http:2.11'
}

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.github.kulya:jmeter-gradle-plugin:1.3.2-2.9'
        classpath "kg.apc:jmeter-plugins:1.1.3"
        classpath "kg.apc:jmeter-plugins-standard:1.1.3"
        classpath "kg.apc:jmeter-plugins-extras:1.1.3"
        classpath "kg.apc:jmeter-plugins-extras-libs:1.1.3"
        classpath 'kg.apc:jmeter-plugins-common:1.1.3'
    }
}

jmeterRun.configure {
    jmeterTestFiles = [file("src/test/jmeter/test1.jmx")]
    jmeterPluginJars = ["jmeter-plugins-1.1.3.jar","jmeter-plugins-standard-1.1.3.jar","jmeter-plugins-common-1.1.3.jar",
                        "jmeter-plugins-extras-1.1.3.jar","jmeter-plugins-extras-libs-1.1.3.jar", "jmeter-plugins-hadoop-1.1.3.jar"]
    jmeterIgnoreFailure = false
    reportDir ="" file("build/jmeter-report)
    jmeterPropertyFile = file("src/test/jmeter/jmeter.properties")
}

jmeterEditor.configure {
    jmeterPluginJars = ["jmeter-plugins-1.1.3.jar","jmeter-plugins-standard-1.1.3.jar","jmeter-plugins-common-1.1.3.jar",
                        "jmeter-plugins-extras-1.1.3.jar","jmeter-plugins-extras-libs-1.1.3.jar", "jmeter-plugins-hadoop-1.1.3.jar"]
    jmeterIgnoreError = true
    jmeterPropertyFile = file("src/test/jmeter/jmeter.properties")
}
yangzhaoxia commented 10 years ago

Yes, that doesn't work to me. But at least jmeter-plugins-1.1.3.jar","jmeter-plugins-standard-1.1.3.jar" could work with Jmeter 2.9. The other 3 plugin jars may have problem with Jmeter 2.9.

Btw, the mainline code of Jmeter plugin has been updated to Jmeter 2.10 by my team, but Kulya didn't deploy it to maven. I built it by myself then other jmeter plugins can be applied.

Zhaoxia

From: philipbannon notifications@github.com<mailto:notifications@github.com> Reply-To: kulya/jmeter-gradle-plugin reply@reply.github.com<mailto:reply@reply.github.com> Date: Wed, 20 Aug 2014 08:20:22 -0700 To: kulya/jmeter-gradle-plugin jmeter-gradle-plugin@noreply.github.com<mailto:jmeter-gradle-plugin@noreply.github.com> Cc: Zhaoxia Yang Zhaoxia.Yang@blackboard.com<mailto:Zhaoxia.Yang@blackboard.com> Subject: Re: [jmeter-gradle-plugin] The GUI run by jmeterEditor can't display components from JMeter Plugins (#28)

@yangzhaoxiahttps://github.com/yangzhaoxia

Hi, I'm having a very similar issue. How did you get this working? From what I can see the jmeter plugins (version 1.1.3) don't JMeter 2.9.

Below is my build.gradle:

apply plugin: 'java' apply plugin: 'jmeter'

sourceCompatibility = 1.5 version = '1.0'

repositories { mavenCentral() }

dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' //This JMeter plugin source code build depends on JMeter2.9 version. compile 'org.apache.jmeter:ApacheJMeter_core:2.11' compile 'org.apache.jmeter:ApacheJMeter_components:2.11' compile 'org.apache.jmeter:ApacheJMeter_http:2.11' }

buildscript { repositories { mavenCentral() } dependencies { classpath 'com.github.kulya:jmeter-gradle-plugin:1.3.2-2.9' classpath "kg.apc:jmeter-plugins:1.1.3" classpath "kg.apc:jmeter-plugins-standard:1.1.3" classpath "kg.apc:jmeter-plugins-extras:1.1.3" classpath "kg.apc:jmeter-plugins-extras-libs:1.1.3" classpath 'kg.apc:jmeter-plugins-common:1.1.3' } }

jmeterRun.configure { jmeterTestFiles = [file("src/test/jmeter/test1.jmx")] jmeterPluginJars = ["jmeter-plugins-1.1.3.jar","jmeter-plugins-standard-1.1.3.jar","jmeter-plugins-common-1.1.3.jar", "jmeter-plugins-extras-1.1.3.jar","jmeter-plugins-extras-libs-1.1.3.jar", "jmeter-plugins-hadoop-1.1.3.jar"] jmeterIgnoreFailure = false reportDir ="" file("build/jmeter-report) jmeterPropertyFile = file("src/test/jmeter/jmeter.properties") }

jmeterEditor.configure { jmeterPluginJars = ["jmeter-plugins-1.1.3.jar","jmeter-plugins-standard-1.1.3.jar","jmeter-plugins-common-1.1.3.jar", "jmeter-plugins-extras-1.1.3.jar","jmeter-plugins-extras-libs-1.1.3.jar", "jmeter-plugins-hadoop-1.1.3.jar"] jmeterIgnoreError = true jmeterPropertyFile = file("src/test/jmeter/jmeter.properties") }

— Reply to this email directly or view it on GitHubhttps://github.com/kulya/jmeter-gradle-plugin/issues/28#issuecomment-52793663.

This email and any attachments may contain confidential and proprietary information of Blackboard that is for the sole use of the intended recipient. If you are not the intended recipient, disclosure, copying, re-distribution or other use of any of this information is strictly prohibited. Please immediately notify the sender and delete this transmission if you received this email in error.

philipbannon commented 10 years ago

@yangzhaoxia Thanks for the response. Any idea when the JMeter 2.10 will be deployed to Maven?

I know I could build it myself but my project gets built by Bamboo CI server so I'm sure how to pull build 2.10 with each release.

Once again thanks for the response!

yangzhaoxia commented 10 years ago

@philipbannon, I don't have idea. @kulya needs to be touched.

philipbannon commented 10 years ago

Ok no problem thanks for the response @yangzhaoxia

philipbannon commented 10 years ago

@kulya any idea when the latest version will be pushed to maven?