Ubuntu NO-GUI上的JDBC连接器的Jmeter错误

时间:2015-04-30 07:48:11

标签: java mysql ubuntu jdbc jmeter

我想在我的Ubuntu服务器上执行我的.jmx程序(在jmeter for windows上取消),但是当我启动以下命令时: jmeter -n -t TestRemote.jmx -l log.jtl 我在jmeter.log中收到此异常

15/04/30 09:39:27 INFO  - jmeter.util.JMeterUtils: Setting Locale to en_US 2015/04/30 09:39:27 INFO  - jmeter.JMeter: Loading user properties from: /opt/apache-jmeter-2.13/bin/user.properties
2015/04/30 09:39:27 INFO  - jmeter.JMeter: Loading system properties from: /opt/apache-jmeter-2.13/bin/system.properties
2015/04/30 09:39:27 INFO  - jmeter.JMeter: Copyright (c) 1998-2012 The Apache Software Foundation
2015/04/30 09:39:27 INFO  - jmeter.JMeter: Version 2.8.20130705
2015/04/30 09:39:27 INFO  - jmeter.JMeter: java.version=1.7.0_79
2015/04/30 09:39:27 INFO  - jmeter.JMeter: java.vm.name=OpenJDK 64-Bit Server VM
2015/04/30 09:39:27 INFO  - jmeter.JMeter: os.name=Linux
2015/04/30 09:39:27 INFO  - jmeter.JMeter: os.arch=amd64
2015/04/30 09:39:27 INFO  - jmeter.JMeter: os.version=3.13.0-34-generic
2015/04/30 09:39:27 INFO  - jmeter.JMeter: file.encoding=UTF-8
2015/04/30 09:39:27 INFO  - jmeter.JMeter: Default Locale=English (United States)
2015/04/30 09:39:27 INFO  - jmeter.JMeter: JMeter  Locale=English (United States)
2015/04/30 09:39:27 INFO  - jmeter.JMeter: JMeterHome=/usr/share/jmeter
2015/04/30 09:39:27 INFO  - jmeter.JMeter: user.dir  =/opt/apache-jmeter-2.13/bin
2015/04/30 09:39:27 INFO  - jmeter.JMeter: PWD       =/opt/apache-jmeter-2.13/bin
2015/04/30 09:39:27 INFO  - jmeter.JMeter: IP: 10.4x.x.184 Name: jmeter FullName: jmeter.x.x
2015/04/30 09:39:27 INFO  - jmeter.services.FileServer: Default base='/opt/apache-jmeter-2.13/bin'
2015/04/30 09:39:27 INFO  - jmeter.services.FileServer: Set new base='/opt/apache-jmeter-2.13/bin'
2015/04/30 09:39:27 INFO  - jmeter.JMeter: Loading file: TestRemote.jmx
2015/04/30 09:39:27 INFO  - jmeter.save.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2
2015/04/30 09:39:27 INFO  - jmeter.save.SaveService: Using SaveService properties file encoding UTF-8
2015/04/30 09:39:27 INFO  - jmeter.save.SaveService: Using SaveService properties file version 1382180
2015/04/30 09:39:27 INFO  - jmeter.save.SaveService: Using SaveService properties version 2.3
2015/04/30 09:39:27 INFO  - jmeter.save.SaveService: All converter versions present and correct
2015/04/30 09:39:27 ERROR - jmeter.save.SaveService: Conversion error com.thoughtworks.xstream.converters.ConversionException: org.apache.jmeter.protocol.jdbc.config.DataSourceElement : org.apache.jmeter.protocol.jdbc.config.DataSourceE$
---- Debugging information ----
message             : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/JDBCDataSource
line number         : 80
------------------------------- : org.apache.jmeter.protocol.jdbc.config.DataSourceElement : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
---- Debugging information ----
message             : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/JDBCDataSource
line number         : 80
-------------------------------
message             : org.apache.jmeter.protocol.jdbc.config.DataSourceElement : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
---- Debugging information ----
message             : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/JDBCDataSource
line number         : 80
-------------------------------
cause-exception     : com.thoughtworks.xstream.converters.ConversionException

我将mysql数据库的jdbc连接器添加到我服务器上的apache-jmeter-2.13 \ lib。 我该如何解决这个问题?

编辑:将mysql的jdbc连接器添加到apache-jmeter-2.13 \ lib \ ext我得到了这个错误:

2015/05/04 10:07:36 INFO  - jmeter.util.JMeterUtils: Setting Locale to en_US
2015/05/04 10:07:36 INFO  - jmeter.JMeter: Loading user properties from: /opt/apache-jmeter-2.13/bin/user.properties
2015/05/04 10:07:36 INFO  - jmeter.JMeter: Loading system properties from: /opt/apache-jmeter-2.13/bin/system.properties
2015/05/04 10:07:36 INFO  - jmeter.JMeter: Copyright (c) 1998-2012 The Apache Software Foundation
2015/05/04 10:07:36 INFO  - jmeter.JMeter: Version 2.8.20130705
2015/05/04 10:07:36 INFO  - jmeter.JMeter: java.version=1.7.0_79
2015/05/04 10:07:36 INFO  - jmeter.JMeter: java.vm.name=OpenJDK 64-Bit Server VM
2015/05/04 10:07:36 INFO  - jmeter.JMeter: os.name=Linux
2015/05/04 10:07:36 INFO  - jmeter.JMeter: os.arch=amd64
2015/05/04 10:07:36 INFO  - jmeter.JMeter: os.version=3.13.0-34-generic
2015/05/04 10:07:36 INFO  - jmeter.JMeter: file.encoding=UTF-8
2015/05/04 10:07:36 INFO  - jmeter.JMeter: Default Locale=English (United States)
2015/05/04 10:07:36 INFO  - jmeter.JMeter: JMeter  Locale=English (United States)
2015/05/04 10:07:36 INFO  - jmeter.JMeter: JMeterHome=/usr/share/jmeter
2015/05/04 10:07:36 INFO  - jmeter.JMeter: user.dir  =/opt/apache-jmeter-2.13/bin
2015/05/04 10:07:36 INFO  - jmeter.JMeter: PWD       =/opt/apache-jmeter-2.13/bin
2015/05/04 10:07:36 INFO  - jmeter.JMeter: IP: 10.4x.x.184 Name: jmeter FullName: jmeter.x.x
2015/05/04 10:07:36 INFO  - jmeter.services.FileServer: Default base='/opt/apache-jmeter-2.13/bin'
2015/05/04 10:07:36 INFO  - jmeter.services.FileServer: Set new base='/opt/apache-jmeter-2.13/bin'
2015/05/04 10:07:36 INFO  - jmeter.JMeter: Loading file: TestRemote.jmx
2015/05/04 10:07:37 INFO  - jmeter.save.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2
2015/05/04 10:07:37 INFO  - jmeter.save.SaveService: Using SaveService properties file encoding UTF-8
2015/05/04 10:07:37 INFO  - jmeter.save.SaveService: Using SaveService properties file version 1382180
2015/05/04 10:07:37 INFO  - jmeter.save.SaveService: Using SaveService properties version 2.3
2015/05/04 10:07:37 INFO  - jmeter.save.SaveService: All converter versions present and correct
2015/05/04 10:07:37 ERROR - jmeter.save.SaveService: Conversion error com.thoughtworks.xstream.converters.ConversionException: org.apache.jmeter.protocol.jdbc.config.DataSourceElement : org.apache.jmeter.protocol.jdbc.config.DataSourceE$
---- Debugging information ----
message             : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/JDBCDataSource
line number         : 80
------------------------------- : org.apache.jmeter.protocol.jdbc.config.DataSourceElement : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
---- Debugging information ----
message             : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/JDBCDataSource
line number         : 80
-------------------------------
message             : org.apache.jmeter.protocol.jdbc.config.DataSourceElement : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
---- Debugging information ----
message             : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
class               : org.apache.jorphan.collections.ListedHashTree
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.converters.HashTreeConverter
path                : /jmeterTestPlan/hashTree/hashTree/JDBCDataSource
line number         : 80
-------------------------------
cause-exception     : com.thoughtworks.xstream.converters.ConversionException
cause-message       : org.apache.jmeter.protocol.jdbc.config.DataSourceElement : org.apache.jmeter.protocol.jdbc.config.DataSourceElement
first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:65)
class               : org.apache.jmeter.save.ScriptWrapper
required-type       : org.apache.jorphan.collections.ListedHashTree
converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
path                : /jmeterTestPlan/hashTree/hashTree/JDBCDataSource
line number         : 80
version             : 2.8.20130705
-------------------------------
2015/05/04 10:07:37 ERROR - jmeter.JMeter: Error in NonGUIDriver java.lang.NullPointerException
        at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:93)
        at org.apache.jmeter.JMeter.runNonGui(JMeter.java:745)
        at org.apache.jmeter.JMeter.startNonGui(JMeter.java:723)
        at org.apache.jmeter.JMeter.start(JMeter.java:388)
        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:606)
        at org.apache.jmeter.NewDriver.main(NewDriver.java:216)
编辑:我试图只使用BeanShell sampler运行一个简单的代码(log.info(“Hello”);)然而它没有用,它抛出了这个异常:

2015/05/07 12:28:51 ERROR - jmeter.save.SaveService: Conversion error com.thoughtworks.xstream.converters.ConversionException: org.apache.jmeter.protocol.java.sampler.BeanShellSampler : org.apache.jmeter.protocol.java.sampler.BeanShellSampler

这是我的jmx程序:

<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.8" jmeter="2.13 r1665067">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
      <stringProp name="TestPlan.comments"></stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <longProp name="ThreadGroup.start_time">1430993955000</longProp>
        <longProp name="ThreadGroup.end_time">1430993955000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <BeanShellSampler guiclass="BeanShellSamplerGui" testclass="BeanShellSampler" testname="BeanShell Sampler" enabled="true">
          <stringProp name="BeanShellSampler.query">log.info(&quot;ciao&quot;);</stringProp>
          <stringProp name="BeanShellSampler.filename"></stringProp>
          <stringProp name="BeanShellSampler.parameters"></stringProp>
          <boolProp name="BeanShellSampler.resetInterpreter">false</boolProp>
        </BeanShellSampler>
        <hashTree/>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>

2 个答案:

答案 0 :(得分:0)

看起来JMeter在启动期间需要您的JDBC类。将您的jdbc jar放在jmeter\lib\ext文件夹中。

答案 1 :(得分:0)

我解决了这个问题,在jmeter之前添加./:

./jmeter -n -t BeanShellSampler.jmx