尝试在 JMeter 和 Kibana 之间集成时出错

Error while trying integration between JMeter and Kibana

我正在尝试使用本手册将 Jmeter 连接到 Kibana: https://blogs.sap.com/2016/04/06/load-testing-with-jmeter-test-results-visualization-using-kibana-dashboards/comment-page-1/#comment-398399

017-11-11 09:39:12,429 ERROR o.a.j.g.GuiPackage: Problem retrieving gui for org.apache.jmeter.visualizers.backend.BackendListenerGui java.lang.NoClassDefFoundError: org/elasticsearch/client/RestClientBuilder$HttpClientConfigCallback at java.lang.Class.forName0(Native Method) ~[?:1.8.0_141] at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_141] at org.apache.jmeter.visualizers.backend.BackendListenerGui.actionPerformed(BackendListenerGui.java:166) ~[ApacheJMeter_components.jar:3.2 r1790748] at javax.swing.JComboBox.fireActionEvent(Unknown Source) ~[?:1.8.0_141] at javax.swing.JComboBox.setSelectedItem(Unknown Source) ~[?:1.8.0_141] at javax.swing.JComboBox.setSelectedIndex(Unknown Source) ~[?:1.8.0_141] at org.apache.jmeter.visualizers.backend.BackendListenerGui.clearGui(BackendListenerGui.java:281) ~[ApacheJMeter_components.jar:3.2 r1790748] at org.apache.jmeter.gui.GuiPackage.createTestElement(GuiPackage.java:348) ~[ApacheJMeter_core.jar:3.2 r1790748] at org.apache.jmeter.gui.action.AddToTree.doAction(AddToTree.java:68) ~[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[=10=](ActionRouter.java:59) ~[ApacheJMeter_core.jar:3.2 r1790748] at java.awt.event.InvocationEvent.dispatch(Unknown Source) [?:1.8.0_141] at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [?:1.8.0_141] at java.awt.EventQueue.access0(Unknown Source) [?:1.8.0_141] at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_141] at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_141] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_141] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) [?:1.8.0_141] at java.awt.EventQueue.dispatchEvent(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.run(Unknown Source) [?:1.8.0_141] Caused by: java.lang.ClassNotFoundException: org.elasticsearch.client.RestClientBuilder$HttpClientConfigCallback at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_141] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_141] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_141] ... 25 more 2017-11-11 09:39:40,782 ERROR o.a.j.g.a.AddToTree: Exception while adding a component to tree. java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/elasticsearch/client/RestClientBuilder$HttpClientConfigCallback at org.apache.jmeter.gui.GuiPackage.createTestElement(GuiPackage.java:359) ~[ApacheJMeter_core.jar:3.2 r1790748] at org.apache.jmeter.gui.action.AddToTree.doAction(AddToTree.java:68) ~[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[=10=](ActionRouter.java:59) ~[ApacheJMeter_core.jar:3.2 r1790748] at java.awt.event.InvocationEvent.dispatch(Unknown Source) [?:1.8.0_141] at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [?:1.8.0_141] at java.awt.EventQueue.access0(Unknown Source) [?:1.8.0_141] at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_141] at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_141] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_141] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) [?:1.8.0_141] at java.awt.EventQueue.dispatchEvent(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_141] at java.awt.EventDispatchThread.run(Unknown Source) [?:1.8.0_141] Caused by: java.lang.NoClassDefFoundError: org/elasticsearch/client/RestClientBuilder$HttpClientConfigCallback at java.lang.Class.forName0(Native Method) ~[?:1.8.0_141] at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_141] at org.apache.jmeter.visualizers.backend.BackendListenerGui.actionPerformed(BackendListenerGui.java:166) ~[ApacheJMeter_components.jar:3.2 r1790748] at javax.swing.JComboBox.fireActionEvent(Unknown Source) ~[?:1.8.0_141] at javax.swing.JComboBox.setSelectedItem(Unknown Source) ~[?:1.8.0_141] at javax.swing.JComboBox.setSelectedIndex(Unknown Source) ~[?:1.8.0_141] at org.apache.jmeter.visualizers.backend.BackendListenerGui.clearGui(BackendListenerGui.java:281) ~[ApacheJMeter_components.jar:3.2 r1790748] at org.apache.jmeter.gui.GuiPackage.createTestElement(GuiPackage.java:348) ~[ApacheJMeter_core.jar:3.2 r1790748] ... 17 more Caused by: java.lang.ClassNotFoundException: org.elasticsearch.client.RestClientBuilder$HttpClientConfigCallback at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_141] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_141] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_141] at java.lang.Class.forName0(Native Method) ~[?:1.8.0_141] at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_141] at org.apache.jmeter.visualizers.backend.BackendListenerGui.actionPerformed(BackendListenerGui.java:166) ~[ApacheJMeter_components.jar:3.2 r1790748] at javax.swing.JComboBox.fireActionEvent(Unknown Source) ~[?:1.8.0_141] at javax.swing.JComboBox.setSelectedItem(Unknown Source) ~[?:1.8.0_141] at javax.swing.JComboBox.setSelectedIndex(Unknown Source) ~[?:1.8.0_141] at org.apache.jmeter.visualizers.backend.BackendListenerGui.clearGui(BackendListenerGui.java:281) ~[ApacheJMeter_components.jar:3.2 r1790748] at org.apache.jmeter.gui.GuiPackage.createTestElement(GuiPackage.java:348) ~[ApacheJMeter_core.jar:3.2 r1790748] ... 17 more

您缺少一个 jar,它是 REST 客户端 jar,只需将以下 jar 添加到您的 lib 文件夹 (C:\Jmeter\apache-jmeter-3.2\lib)

elasticsearch-rest-client-5.6.4.jar

我不认为 JMeter 会递归地搜索其 "lib" 文件夹中的任何文件夹以查找可以添加到其类路径中的任何 .jars,因此我建议将所有 .jars 从 elasticsearch-5.6.4 文件夹到 JMeter 的 "lib" 文件夹。

或者,您可以将下一行添加到 user.properties 文件(位于 JMeter 安装的 "bin" 文件夹下)

user.classpath=C:\Jmeter\apache-jmeter-3.2\lib\elasticsearch-5.6.4`

在这两种情况下,都需要重新启动 JMeter 才能获取库。

更多信息: