从命令行运行jmeter测试时获得未捕获的异常

时间:2013-09-02 10:50:36

标签: apache powershell jmeter load-testing jmeter-plugins

我使用jmeter使用命令行运行负载测试,然后尝试生成聚合报告,然后根据生成的报告显示图形。我使用以下powershell脚本来执行此操作。

#!/bin/bash

cd Z:\TestPlansUsingJmeter\apache-jmeter-2.9\bin

# Run Test
.\jmeter -n -t Z:\TestPlansUsingJmeter\GetAvailability.jmx -l    Z:\TestPlansUsingJmeter\Results\results.jtl

# Generate PNG File using plugin
java -jar Z:\TestPlansUsingJmeter\apache-jmeter-2.9\lib\ext\CMDRunner.jar --tool Reporter --generate-png Z:\TestPlansUsingJmeter\graphs\test.png --input-jtl    Z:\TestPlansUsingJmeter\Results\results.jtl --plugin-type ResponseTimesOverTime --width 800 --height 600

请指导我做错了,因为在执行此操作后不断收到以下错误: -

.\jmeter : Uncaught Exception java.lang.NullPointerException. See log file for details.
At line:6 char:1
+ .\jmeter -n -t Z:\TestPlansUsingJmeter\GetAvailability.jmx -l Z:\T ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (Uncaught Except...le for details.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

java : java.lang.Throwable: Could not access Z:\TestPlansUsingJmeter\apache-jmeter-2.9\lib\ext\lib
At line:9 char:1
+ java -jar Z:\TestPlansUsingJmeter\apache-jmeter-2.9\lib\ext\CMDRunner.jar --tool ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo          : NotSpecified: (java.lang.Throw...2.9\lib\ext\lib:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

at kg.apc.cmd.UniversalRunner.buildUpdatedClassPath(UniversalRunner.java:109)
at kg.apc.cmd.UniversalRunner.<clinit>(UniversalRunner.java:55)

2 个答案:

答案 0 :(得分:1)

这是一个Java异常,而不是PowerShell异常(即它无法在PowerShell中捕获),并且错误消息相当不言自明:

  

无法访问Z:\ TestPlansUsingJmeter \ apache-jmeter-2.9 \ lib \ ext \ lib

检查文件夹是否存在以及运行jmeter的用户是否可以访问它。

答案 1 :(得分:0)

似乎是一个错误。由于脚本添加了一些具有相同名称的禁用测试。从测试中删除它们解决了问题。看起来它们在通过GUI执行时没有问题,但是当使用非GUI模式执行时会产生异常。