Jmeter HTTPS测试脚本记录器 - 无法初始化密钥库

时间:2014-10-28 14:49:51

标签: jmeter

尝试启动时出现以下错误

OS - Mac OS X 10.9.4
Java Version 
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
For setting Java home
export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.bash_profile
When  echo $JAVA_HOME
$(/usr/libexec/java_home)

尝试时

$ java keytool

Exception in thread "main" java.lang.NoClassDefFoundError: keytool
Caused by: java.lang.ClassNotFoundException: keytool

我在路径中添加了Java home

echo $PATH
-bash: $(/usr/libexec/java_home)/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin: No such file or directory


014/10/27 16:11:21 ERROR - jmeter.protocol.http.proxy.ProxyControl: Could not initialise key store java.io.IOException: Command :'keytool -genkeypair -alias :root_ca: -dname "CN=_ DO NOT INSTALL unless this is your certificate (JMeter root CA), OU=Username: maitriacharya, C=US" -keyalg RSA -keystore proxyserver.jks -storepass {redacted) -keypass {redacted) -validity 7 -ext bc:c' failed, code: 1
Illegal option:  -ext
Try keytool -help

    at org.apache.jorphan.exec.KeyToolUtils.genkeypair(KeyToolUtils.java:168)
    at org.apache.jorphan.exec.KeyToolUtils.generateProxyCA(KeyToolUtils.java:230)
    at org.apache.jmeter.protocol.http.proxy.ProxyControl.initDynamicKeyStore(ProxyControl.java:1281)
    at org.apache.jmeter.protocol.http.proxy.ProxyControl.initKeyStore(ProxyControl.java:1208)
    at org.apache.jmeter.protocol.http.proxy.ProxyControl.startProxy(ProxyControl.java:434)
    at org.apache.jmeter.protocol.http.proxy.gui.ProxyControlGui.startProxy(ProxyControlGui.java:485)
    at org.apache.jmeter.protocol.http.proxy.gui.ProxyControlGui.actionPerformed(ProxyControlGui.java:370)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6516)

1 个答案:

答案 0 :(得分:0)

确保您有可用的JDK,并且正在使用它运行JMeter。

还要确保keytool命令行具有“ -ext”选项,您至少需要JDK 7u50,请参见:

请注意,自JMeter 3.2起,必须使用Java 8。