在jenkins中运行jmeter时的org / openqa / selenium / remote / SessionNotFoundException

时间:2016-11-24 05:43:06

标签: selenium jenkins jmeter jmeter-plugins

最近,我在Jenkins的Firefox驱动程序中启动了web app jmeter案例时遇到了一个问题。

我可以在Jenkins服务器终端上使用非GUI模式成功运行它。 我也可以使用Jmeter UI在Jenkins服务器上成功运行它。 但是当我通过Jenkins工作踢它时,它通过以下错误:

jmeter -n -t jmeter.jmx -l result.jtl 

Writing log file to: /var/lib/jenkins/workspace/test/srm-bermuda/jmeter.log
Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from:'/var/lib/jenkins/workspace/test/srm-bermuda/jmeter.jmx', missing class com.thoughtworks.xstream.converters.ConversionException: org/openqa/selenium/remote/SessionNotFoundException : org/openqa/selenium/remote/SessionNotFoundException
---- Debugging information ----
message             : org/openqa/selenium/remote/SessionNotFoundException
cause-exception     : java.lang.NoClassDefFoundError
cause-message       : org/openqa/selenium/remote/SessionNotFoundException
first-jmeter-class  : org.apache.jmeter.save.converters.TestElementConverter.unmarshal(TestElementConverter.java:100)
class               : org.apache.jmeter.save.ScriptWrapper
required-type       : com.googlecode.jmeter.plugins.webdriver.config.FirefoxDriverConfig
converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/com.googlecode.jmeter.plugins.webdriver.config.FirefoxDriverConfig
line number         : 29
version             : 3.0 r1743807

如果有人可以帮助我,那就太好了!

更新了完整的jenkins日志,其中也打印出jmeter.log:

+ cd srm-bermuda
+ ls
jmeter.jmx
jmeter.log
jmeter_UI.jmx
simple.jmx
success_login.jmx
test.har
+ result=result.jtl
+ [ -f result.jtl ]
+ rm -rf dashboard
+ export     PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/var/lib/jenkins/.rvm/bin:/data/jre1.7.0_79/bin:/data/apache-jmeter-3.0/bin:/data/apache-jmeter-3.0/lib:/data/apache-jmeter-3.0/lib/ext
+ jmeter -n -t jmeter_UI.jmx -l result.jtl -H cn-proxy.jp.oracle.com -P 80
Writing log file to: /var/lib/jenkins/workspace/test/srm-bermuda/jmeter.log
Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading     XML from:'/var/lib/jenkins/workspace/test/srm-bermuda/jmeter_UI.jmx', missing     class com.thoughtworks.xstream.converters.ConversionException:     org/openqa/selenium/WebDriverException : org/openqa/selenium/WebDriverException
---- Debugging information ----
message             : org/openqa/selenium/WebDriverException
cause-exception     : java.lang.NoClassDefFoundError
cause-message       : org/openqa/selenium/WebDriverException
first-jmeter-class  : org.apache.jmeter.save.converters.TestElementConverter.unmarshal(TestElementConverter.java:100)
class               : org.apache.jmeter.save.ScriptWrapper
required-type       : com.googlecode.jmeter.plugins.webdriver.config.FirefoxDriverConfig
converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/com.googlecode.jmeter.plugins.webdriv    er.config.FirefoxDriverConfig
line number         : 29
version             : 3.0 r1743807
-------------------------------
+ cat jmeter.log
2016/11/24 16:12:16 INFO  - jmeter.util.JMeterUtils: Setting Locale to en_US 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: Loading user properties from:     /data/apache-jmeter-3.0/bin/user.properties 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: Loading system properties from: /data/apache-jmeter-3.0/bin/system.properties 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: Copyright (c) 1998-2016 The Apache Software Foundation 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: Version 3.0 r1743807 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: java.version=1.7.0_79 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: java.vm.name=Java HotSpot(TM) Server VM 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: os.name=Linux 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: os.arch=i386 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: os.version=3.5.0-23-generic 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: file.encoding=UTF-8 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: Max memory     =514850816 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: Available Processors =4 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: Default Locale=English (United States) 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: JMeter  Locale=English (United States) 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: JMeterHome=/data/apache-jmeter-3.0 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: user.dir  =/var/lib/jenkins/workspace/test/srm-bermuda 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: PWD       =/var/lib/jenkins/workspace/test/srm-bermuda 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: IP: 127.0.1.1 Name: rockets-OptiPlex-7010 FullName: rockets-OptiPlex-7010 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: Set http[s].proxyHost: cn-proxy.jp.oracle.com Port: 80 
2016/11/24 16:12:16 INFO  - jmeter.JMeter: user.classpath=/data/apache-jmeter-3.0/lib;/data/apache-jmeter-3.0/lib/ext 
2016/11/24 16:12:16 WARN  - jmeter.JMeter: Can't read /data/apache-jmeter-3.0/lib;/data/apache-jmeter-3.0/lib/ext 
2016/11/24 16:12:16 INFO  - jmeter.services.FileServer: Default base='/var/lib/jenkins/workspace/test/srm-bermuda' 
2016/11/24 16:12:16 INFO  - jmeter.services.FileServer: Set new base='/var/lib/jenkins/workspace/test/srm-bermuda' 
2016/11/24 16:12:16 INFO  - jmeter.save.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2 
2016/11/24 16:12:16 INFO  - jmeter.save.SaveService: Using SaveService properties file encoding UTF-8 
2016/11/24 16:12:16 INFO  - jmeter.save.SaveService: Using SaveService properties version 2.9 
2016/11/24 16:12:16 INFO  - jmeter.save.SaveService: All converter versions present and correct 
2016/11/24 16:12:16 INFO  - jmeter.save.SaveService: Loading file: jmeter_UI.jmx 
2016/11/24 16:12:16 ERROR - jmeter.JMeter: Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from:'/var/lib/jenkins/workspace/test/srm-bermuda/jmeter_UI.jmx', missing class com.thoughtworks.xstream.converters.ConversionException: org/openqa/selenium/WebDriverException : org/openqa/selenium/WebDriverException
---- Debugging information ----
message             : org/openqa/selenium/WebDriverException
cause-exception     : java.lang.NoClassDefFoundError
cause-message       : org/openqa/selenium/WebDriverException
first-jmeter-class  : org.apache.jmeter.save.converters.TestElementConverter.unmarshal(TestElementConverter.java:100)
class               : org.apache.jmeter.save.ScriptWrapper
required-type       : com.googlecode.jmeter.plugins.webdriver.config.FirefoxDriverConfig
converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/com.googlecode.jmeter.plugins.webdriver.config.FirefoxDriverConfig
line number         : 29
version             : 3.0 r1743807
-------------------------------
at org.apache.jmeter.save.SaveService.readTree(SaveService.java:539)
at org.apache.jmeter.save.SaveService.loadTree(SaveService.java:503)
at org.apache.jmeter.JMeter.runNonGui(JMeter.java:889)
at org.apache.jmeter.JMeter.startNonGui(JMeter.java:876)
at org.apache.jmeter.JMeter.start(JMeter.java:501)
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.apache.jmeter.NewDriver.main(NewDriver.java:259)
Caused by: com.thoughtworks.xstream.converters.ConversionException: org/openqa/selenium/WebDriverException : org/openqa/selenium/WebDriverException
---- Debugging information ----
message             : org/openqa/selenium/WebDriverException
cause-exception     : java.lang.NoClassDefFoundError
cause-message       : org/openqa/selenium/WebDriverException
first-jmeter-class  : org.apache.jmeter.save.converters.TestElementConverter.unmarshal(TestElementConverter.java:100)
class               : org.apache.jmeter.save.ScriptWrapper
required-type       : com.googlecode.jmeter.plugins.webdriver.config.FirefoxDriverConfig
converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/com.googlecode.jmeter.plugins.webdriver.config.FirefoxDriverConfig
line number         : 29
version             : 3.0 r1743807
-------------------------------
    at org.apache.jmeter.save.ScriptWrapperConverter.createConversionException(ScriptWrapperConverter.java:103)
at org.apache.jmeter.save.ScriptWrapperConverter.unmarshal(ScriptWrapperConverter.java:97)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1206)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1190)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1061)
at org.apache.jmeter.save.SaveService.readTree(SaveService.java:524)
... 9 more
Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriverException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.jmeter.save.converters.TestElementConverter.unmarshal(TestElementConverter.java:100)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at org.apache.jmeter.save.ScriptWrapperConverter.unmarshal(ScriptWrapperConverter.java:95)
... 19 more
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.WebDriverException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 58 more

1 个答案:

答案 0 :(得分:1)

此“NoClassDefFoundError”错误通常表示包含该类的引用.jar文件不在Java Classpath中,或者在JMeter Classpath中。对于JMeter插件,最常见的情况是:人们将插件库安装到“lib / ext”文件夹中,但忘记将依赖项安装到其JMeter安装的“lib”文件夹中。你最有可能患上同样的痛苦。所以我建议2个选项:

  1. 比较JMeter安装的“lib”和“lib / ext”文件夹:

    • 可以成功运行测试的机器
    • Jenkins构建代理

    并同步所有更改,以使文件夹完全相同。

  2. 安装JMeter插件并使其保持最新的推荐方法是使用JMeter Plugins Manager,这样您就可以“干净”地分发最新的JMeter并使用插件管理器安装所有必需的插件