我使用的JMeter Maven插件來執行JMX測試文件,它會罰款GUI壓力測試和Web服務測試:利用JMeter Maven插件運行JMX監視器收集聽衆
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.10.1</version>
<executions>
<execution>
<id>jmeter-test</id>
<phase>test</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<overrideRootLogLevel>debug</overrideRootLogLevel>
<testFilesIncluded>
<jMeterTestFile>pim_stress.jmx</jMeterTestFile>
</testFilesIncluded>
<resultsFileNameDateFormat>ddMMyyyy</resultsFileNameDateFormat>
<ignoreResultFailures>false</ignoreResultFailures>
<propertiesUser>
<threadgroup.numberOfThreads>10</threadgroup.numberOfThreads>
<threadgroup.rampUp>1</threadgroup.rampUp>
<threadgroup.host>localhost</threadgroup.host>
<threadgroup.port>8332</threadgroup.port>
</propertiesUser>
<workingDirectory>target/</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
然後我需要添加一個在我的Jmeter disktop應用程序(Jmeter 2.9)中使用JMXMon Samples Collector listener類型的監聽器,此監聽器用於在測試運行時隨時間繪製JMX性能指標,更新後的jmeter測試在Jmeter 2.9中正常工作,聽衆:
<kg.apc.jmeter.jmxmon.JMXMonCollector guiclass="kg.apc.jmeter.vizualizers.JMXMonGui" testclass="kg.apc.jmeter.jmxmon.JMXMonCollector" testname="[email protected] - JMXMon Samples Collector" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>false</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
</value>
</objProp>
<stringProp name="filename">${__P(result.monitoring)}</stringProp>
<longProp name="interval_grouping">1000</longProp>
<boolProp name="graph_aggregated">false</boolProp>
<stringProp name="include_sample_labels"></stringProp>
<stringProp name="exclude_sample_labels"></stringProp>
<stringProp name="start_offset"></stringProp>
<stringProp name="end_offset"></stringProp>
<boolProp name="include_checkbox_state">false</boolProp>
<boolProp name="exclude_checkbox_state">false</boolProp>
<collectionProp name="samplers">
<collectionProp name="-362669779">
<stringProp name="868201267">NbSessionsTotal</stringProp>
<stringProp name="942166118">service:jmx:remoting-jmx://localhost:4697</stringProp>
<stringProp name="105365">jmx</stringProp>
<stringProp name="-1255434677">[email protected]</stringProp>
<stringProp name="377390660">pim.monitoring:service=JmxSystem</stringProp>
<stringProp name="868201267">NbSessionsTotal</stringProp>
<stringProp name="0"></stringProp>
<stringProp name="1237">false</stringProp>
</collectionProp>
</collectionProp>
</kg.apc.jmeter.jmxmon.JMXMonCollector>
但是當我試圖運行這個測試計劃(JMX文件)通過的JMeter Maven插件(用於自動化測試的原因),它返回一個錯誤:
Caused by: com.thoughtworks.xstream.converters.ConversionException: kg.apc.jmeter.jmxmon.JMXMonCollector : kg.apc.jmeter.jmxmon.JMXMonCollector
---- Debugging information ----
message : kg.apc.jmeter.jmxmon.JMXMonCollector
cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : kg.apc.jmeter.jmxmon.JMXMonCollector
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/hashTree/kg.apc.jmeter.jmxmon.JMXMonCollector
line number : 430
-------------------------------
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
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: com.thoughtworks.xstream.mapper.CannotResolveClassException: kg.apc.jmeter.jmxmon.JMXMonCollector
at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:79)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:79)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:74)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.SecurityMapper.realClass(SecurityMapper.java:71)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at org.apache.jmeter.save.SaveService$XStreamWrapper$1.realClass(SaveService.java:94)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:47)
at com.thoughtworks.xstream.core.util.HierarchicalStreams.readClassType(HierarchicalStreams.java:29)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:70)
at org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
... 35 more
有誰有一個想法...感謝很多提前?!
非常感謝automatictester;這正是我需要的..它非常高效! :) – Shessuky