linux - 在 Linux 中的 JAVA_OPTS 中传递带空格的参数时抛出错误

标签 linux scala performance-testing load-testing gatling

我正在将命令行参数传递给 gatling 脚本。

这可以在 Windows 操作系统中运行并执行我的测试:

set JAVA_OPTS="-DuserCount=2 -DflowRepeatCount=3 -DdefinitionId=102168 -DtestServerUrl=https://someURL -DenvAuthenticationHeaderFromPostman="Basic UWRZm9aGwsxFsB1V7RXK0OlB5cmZvcm1hbmNldGVzdDE="

它工作并接受传递的输入

**********************INPUT*************************************
User Count ====>>  2
Repeat Count ====>> 3
Definition ID ====>> 102168
Environment URL ====>> https://someURL
Authentication Header ====>> Basic UWRZm9aGwsxFsB1V7RXK0OlB5cmZvcm1hbmNldGVzdDE=
***********************************************************

我想在 Linux 系统上做同样的事情。 如果我在 Linux 中使用此命令,则它会抛出错误或将 Null 或 Binary 值作为输入 (通过 ./gatling.sh 传递参数)

JAVA_OPTS="-DuserCount=2 -DflowRepeatCount=3 -DdefinitionId=102168 -DtestServerUrl='https://someURL' -DenvAuthenticationHeaderFromPostman='Basic UWRZm9aGwsxFsB1V7RXK0OlB5cmZvcm1hbmNldGVzdDE='"  ./gatling.sh

给出这个错误,

GATLING_HOME is set to /opt/gatling-charts-highcharts-2.0.3 Error: Could not find or load main class UWRZm9aGwsxFsB1V7RXK0OlB5cmZvcm1hbmNldGVzdDE='

这里的问题是 -DenvAuthenticationHeaderFromPostman='Basic UWRZm9aGwsxFsB1V7RXK0OlB5cmZvcm1hbm=' 参数中给出的空间

解决方案是什么?

最佳答案

问题是 $JAVA_OPTS 变量可能没有被引号包围。看到这个问题:Passing a space-separated System Property via a shell script doesn't work

The gatling guys clearly forgot to do that .

我会提交错误和/或只编辑 gatling.sh

理想情况下,尽管您可能只想考虑查看 Gatling 是否采用属性文件或 some other way to configure .

关于linux - 在 Linux 中的 JAVA_OPTS 中传递带空格的参数时抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38349325/

相关文章:

scala - 使用 Scala 的 REPL 进行性能基准比较是否合理?

linux - addr2line如何定位源文件和代码行?

linux - 使用 nmcli 以编程方式激活和停用网络接口(interface)

c - exec 系列函数的工作

scala - 与任一选项的替代方案

c# - 使用 Visual Studio 2013 对 REST API 进行性能测试

linux - 尝试在 Linux From Scratch 之后制作 QTWebKit 时出错

scala - 我很想知道 IDEA 的这个烦人的功能是什么 --- 这样我就可以将其关闭

scala - 如何存储纯scala代码

performance - 如何测量进程之间的干扰