title: JMS Point to Point Jmeter Load Testing - NoInitialContextException
body: <p>I was trying to test JMS using Jmeter and was trying to run it in local, but keep getting the error:
  Response message: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.activemq.jndi.ActiveMQInitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.apache.activemq.jndi.ActiveMQInitialContextFactory]</p>
  
  <p>I have already added the activemq-all.jar file in lib folder of jmeter, which should have resolved the issue, but it remains.</p>
  
  <p>Please help me understand if I am missing something. Thanks.</p>
  
  <p>Below is my jmx file content for the test plan:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935"&gt;
    &lt;hashTree&gt;
      &lt;TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="JMS P2P Load Test" enabled="true"&gt;
        &lt;stringProp name="TestPlan.comments"&gt;&lt;/stringProp&gt;
        &lt;boolProp name="TestPlan.functional_mode"&gt;false&lt;/boolProp&gt;
        &lt;boolProp name="TestPlan.tearDown_on_shutdown"&gt;true&lt;/boolProp&gt;
        &lt;boolProp name="TestPlan.serialize_threadgroups"&gt;false&lt;/boolProp&gt;
        &lt;elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"&gt;
          &lt;collectionProp name="Arguments.arguments"/&gt;
        &lt;/elementProp&gt;
        &lt;stringProp name="TestPlan.user_define_classpath"&gt;&lt;/stringProp&gt;
      &lt;/TestPlan&gt;
      &lt;hashTree&gt;
        &lt;ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="JMSTestPlan-P2P" enabled="true"&gt;
          &lt;stringProp name="ThreadGroup.on_sample_error"&gt;continue&lt;/stringProp&gt;
          &lt;elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"&gt;
            &lt;boolProp name="LoopController.continue_forever"&gt;false&lt;/boolProp&gt;
            &lt;stringProp name="LoopController.loops"&gt;2&lt;/stringProp&gt;
          &lt;/elementProp&gt;
          &lt;stringProp name="ThreadGroup.num_threads"&gt;1&lt;/stringProp&gt;
          &lt;stringProp name="ThreadGroup.ramp_time"&gt;0&lt;/stringProp&gt;
          &lt;boolProp name="ThreadGroup.scheduler"&gt;false&lt;/boolProp&gt;
          &lt;stringProp name="ThreadGroup.duration"&gt;&lt;/stringProp&gt;
          &lt;stringProp name="ThreadGroup.delay"&gt;&lt;/stringProp&gt;
        &lt;/ThreadGroup&gt;
        &lt;hashTree&gt;
          &lt;JMSSampler guiclass="JMSSamplerGui" testclass="JMSSampler" testname="JMS Point-to-Point" enabled="true"&gt;
            &lt;stringProp name="JMSSampler.queueconnectionfactory"&gt;ConnectionFactory&lt;/stringProp&gt;
            &lt;stringProp name="JMSSampler.SendQueue"&gt;Q.REQ&lt;/stringProp&gt;
            &lt;stringProp name="JMSSampler.ReceiveQueue"&gt;Q.REQ&lt;/stringProp&gt;
            &lt;intProp name="JMSSampler.communicationStyle"&gt;0&lt;/intProp&gt;
            &lt;boolProp name="JMSSampler.isNonPersistent"&gt;false&lt;/boolProp&gt;
            &lt;boolProp name="JMSSampler.useReqMsgIdAsCorrelId"&gt;true&lt;/boolProp&gt;
            &lt;stringProp name="JMSSampler.timeout"&gt;2000&lt;/stringProp&gt;
            &lt;stringProp name="JMSSampler.jmsNumberOfSamplesToAggregate"&gt;&lt;/stringProp&gt;
            &lt;stringProp name="HTTPSamper.xml_data"&gt;Testing point to point&lt;/stringProp&gt;
            &lt;stringProp name="JMSSampler.initialContextFactory"&gt;org.apache.activemq.jndi.ActiveMQInitialContextFactory&lt;/stringProp&gt;
            &lt;stringProp name="JMSSampler.contextProviderUrl"&gt;tcp://localhost:61616&lt;/stringProp&gt;
            &lt;elementProp name="JMSSampler.jndiProperties" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"&gt;
              &lt;collectionProp name="Arguments.arguments"&gt;
                &lt;elementProp name="queue.Q.REQ" elementType="Argument"&gt;
                  &lt;stringProp name="Argument.name"&gt;queue.Q.REQ&lt;/stringProp&gt;
                  &lt;stringProp name="Argument.value"&gt;example.A&lt;/stringProp&gt;
                  &lt;stringProp name="Argument.metadata"&gt;=&lt;/stringProp&gt;
                &lt;/elementProp&gt;
              &lt;/collectionProp&gt;
            &lt;/elementProp&gt;
            &lt;elementProp name="arguments" elementType="JMSProperties"&gt;
              &lt;collectionProp name="JMSProperties.properties"/&gt;
            &lt;/elementProp&gt;
            &lt;boolProp name="JMSSampler.useResMsgIdAsCorrelId"&gt;true&lt;/boolProp&gt;
          &lt;/JMSSampler&gt;
          &lt;hashTree/&gt;
          &lt;ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true"&gt;
            &lt;boolProp name="ResultCollector.error_logging"&gt;false&lt;/boolProp&gt;
            &lt;objProp&gt;
              &lt;name&gt;saveConfig&lt;/name&gt;
              &lt;value class="SampleSaveConfiguration"&gt;
                &lt;time&gt;true&lt;/time&gt;
                &lt;latency&gt;true&lt;/latency&gt;
                &lt;timestamp&gt;true&lt;/timestamp&gt;
                &lt;success&gt;true&lt;/success&gt;
                &lt;label&gt;true&lt;/label&gt;
                &lt;code&gt;true&lt;/code&gt;
                &lt;message&gt;true&lt;/message&gt;
                &lt;threadName&gt;true&lt;/threadName&gt;
                &lt;dataType&gt;true&lt;/dataType&gt;
                &lt;encoding&gt;false&lt;/encoding&gt;
                &lt;assertions&gt;true&lt;/assertions&gt;
                &lt;subresults&gt;true&lt;/subresults&gt;
                &lt;responseData&gt;false&lt;/responseData&gt;
                &lt;samplerData&gt;false&lt;/samplerData&gt;
                &lt;xml&gt;false&lt;/xml&gt;
                &lt;fieldNames&gt;true&lt;/fieldNames&gt;
                &lt;responseHeaders&gt;false&lt;/responseHeaders&gt;
                &lt;requestHeaders&gt;false&lt;/requestHeaders&gt;
                &lt;responseDataOnError&gt;false&lt;/responseDataOnError&gt;
                &lt;saveAssertionResultsFailureMessage&gt;true&lt;/saveAssertionResultsFailureMessage&gt;
                &lt;assertionsResultsToSave&gt;0&lt;/assertionsResultsToSave&gt;
                &lt;bytes&gt;true&lt;/bytes&gt;
                &lt;sentBytes&gt;true&lt;/sentBytes&gt;
                &lt;url&gt;true&lt;/url&gt;
                &lt;threadCounts&gt;true&lt;/threadCounts&gt;
                &lt;idleTime&gt;true&lt;/idleTime&gt;
                &lt;connectTime&gt;true&lt;/connectTime&gt;
              &lt;/value&gt;
            &lt;/objProp&gt;
            &lt;stringProp name="filename"&gt;&lt;/stringProp&gt;
          &lt;/ResultCollector&gt;
          &lt;hashTree/&gt;
        &lt;/hashTree&gt;
      &lt;/hashTree&gt;
    &lt;/hashTree&gt;
  &lt;/jmeterTestPlan&gt;
  </code></pre>