gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 03:31:33 24 4
gpt4 key购买 nike

我想在我的 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 采样器 (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>

最佳答案

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

关于java - Ubuntu NO-GUI 上 JDBC 连接器的 Jmeter 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29961966/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com