Jmeter 错误 "javax.naming.NoInitialContextException: Need to specify class name in environment or system property"

Jmeter error "javax.naming.NoInitialContextException: Need to specify class name in environment or system property"

我是第一次使用 Jmeter,当我尝试 运行 JMS Point-to-point 中的任何预定义函数时,我看到如下问题:-

javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

我不太确定必须在此处指定什么 class 名称。

以下是来自日志的信息:-

017-06-27 22:59:06,868 ERROR o.a.j.p.j.s.JMSSampler: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) ~[?:1.8.0_101]
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) ~[?:1.8.0_101]
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source) ~[?:1.8.0_101]
    at javax.naming.InitialContext.lookup(Unknown Source) ~[?:1.8.0_101]
    at org.apache.jmeter.protocol.jms.sampler.JMSSampler.threadStarted(JMSSampler.java:329) [ApacheJMeter_jms.jar:3.2 r1790748]
    at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:677) [ApacheJMeter_core.jar:3.2 r1790748]
    at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:996) [jorphan.jar:3.2 r1790748]
    at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:978) [jorphan.jar:3.2 r1790748]
    at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:646) [ApacheJMeter_core.jar:3.2 r1790748]
    at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:634) [ApacheJMeter_core.jar:3.2 r1790748]
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:250) [ApacheJMeter_core.jar:3.2 r1790748]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_101]
2017-06-27 22:59:06,915 INFO o.a.j.f.LogFunction: Thread Group 1-1  :  "Hello world"
2017-06-27 22:59:06,915 WARN o.a.j.p.j.s.JMSSampler: Session may not be null while creating message 

图片:

您需要提供将创建初始上下文的工厂 class 的完全限定 class 名称。初始上下文是命名操作的起点。

请参阅 javax.naming.Context class JavaDoc 了解更详细的解释(如果有帮助的话)。

所以基本上你需要弄清楚你需要测试什么 Message Queue 服务器,一旦你至少知道正在使用什么,你将需要找出正确的 QueueConnectionFactory 和 InitialContext class 名称,队列名称和其他 JMS 属性。

查看 Building a JMS Testing Plan - Apache JMeter 文章了解更多信息。