啟動JMeter 3.2的時候,發(fā)現(xiàn)JMeter的日志里報異常澜薄,異常信息為無法找到keytool,而之前的版本并沒有這個問題:
java.io.IOException: Cannot run program "keytool": CreateProcess error=2, 系統(tǒng)找不到指定的文件摊册。at java.lang.ProcessBuilder.start(Unknown Source) ~[?:1.8.0_92]at org.apache.jorphan.exec.SystemCommand.run(SystemCommand.java:142) ~[jorphan.jar:3.2 r1790748]at org.apache.jorphan.exec.SystemCommand.run(SystemCommand.java:125) ~[jorphan.jar:3.2 r1790748]at org.apache.jorphan.exec.KeyToolUtils.checkKeytool(KeyToolUtils.java:436) ~[jorphan.jar:3.2 r1790748]at org.apache.jorphan.exec.KeyToolUtils.(KeyToolUtils.java:94) ~[jorphan.jar:3.2 r1790748]at org.apache.jmeter.protocol.http.proxy.ProxyControl.(ProxyControl.java:248) ~[ApacheJMeter_http.jar:3.2 r1790748]at org.apache.jmeter.protocol.http.proxy.gui.ProxyControlGui.createPortPanel(ProxyControlGui.java:708) ~[ApacheJMeter_http.jar:3.2 r1790748]at org.apache.jmeter.protocol.http.proxy.gui.ProxyControlGui.init(ProxyControlGui.java:664) ~[ApacheJMeter_http.jar:3.2 r1790748]at org.apache.jmeter.protocol.http.proxy.gui.ProxyControlGui.(ProxyControlGui.java:239) ~[ApacheJMeter_http.jar:3.2 r1790748]at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_92]at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_92]at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_92]at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_92]at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_92]at org.apache.jmeter.gui.util.MenuFactory.initializeMenus(MenuFactory.java:505) ~[ApacheJMeter_core.jar:3.2 r1790748]at org.apache.jmeter.gui.util.MenuFactory.(MenuFactory.java:169) ~[ApacheJMeter_core.jar:3.2 r1790748]at org.apache.jmeter.control.gui.TestPlanGui.createPopupMenu(TestPlanGui.java:93) ~[ApacheJMeter_core.jar:3.2 r1790748]at org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:156) ~[ApacheJMeter_core.jar:3.2 r1790748]at org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:46) ~[ApacheJMeter_core.jar:3.2 r1790748]at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:74) ~[ApacheJMeter_core.jar:3.2 r1790748]at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed$0(ActionRouter.java:59) ~[ApacheJMeter_core.jar:3.2 r1790748]at java.awt.event.InvocationEvent.dispatch(Unknown Source) [?:1.8.0_92]at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [?:1.8.0_92]at java.awt.EventQueue.access$500(Unknown Source) [?:1.8.0_92]at java.awt.EventQueue$3.run(Unknown Source) [?:1.8.0_92]at java.awt.EventQueue$3.run(Unknown Source) [?:1.8.0_92]at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_92]at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) [?:1.8.0_92]at java.awt.EventQueue.dispatchEvent(Unknown Source) [?:1.8.0_92]at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [?:1.8.0_92]at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [?:1.8.0_92]at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [?:1.8.0_92]at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_92]at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_92]at java.awt.EventDispatchThread.run(Unknown Source) [?:1.8.0_92]Caused by: java.io.IOException: CreateProcess error=2, 系統(tǒng)找不到指定的文件肤京。at java.lang.ProcessImpl.create(Native Method) ~[?:1.8.0_92]at java.lang.ProcessImpl.(Unknown Source) ~[?:1.8.0_92]
at java.lang.ProcessImpl.start(Unknown Source) ~[?:1.8.0_92]
... 35 more
經(jīng)過網(wǎng)上搜索,發(fā)現(xiàn)已經(jīng)有人給JMeter報了bug茅特,項目的人答復(fù)在這里忘分。大意是說這個不是個問題,因為JMeter會有多種方法嘗試找到keytool白修,最終JMeter會從JAVA_HOME變量里找到keytool妒峦,不會影響正常使用,他已經(jīng)把該日志的級別從“Error”降到“Info”兵睛,將來的版本就不會有該問題了肯骇。
如果你是個潔癖,無法忍受這個異常祖很,可以參照這個回答累盗,把keytool所在的目錄加到PATH環(huán)境變量就可以了。