Bug 56809

Summary: JMSSampler closes InitialContext too early
Product: JMeter - Now in Github Reporter: Bradford Hovinen <hovinen>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal CC: p.mouawad
Priority: P2    
Version: 2.11   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patch to fix problem

Description Bradford Hovinen 2014-08-04 12:35:56 UTC
Created attachment 31869 [details]
Patch to fix problem

JMSSampler closes the InitialContext in threadStarted, before the individual requests are sent. When authentication is required for the queue, the credentials are then lost with the closure of the InitialContext. As a result, all send-operations run into the following error:

JMSSecurityException: Access denied to resource: type=<jms>, application=xxxx, destinationType=queue, resource=xxxx, action=send
        at weblogic.jms.dispatcher.DispatcherAdapter.convertToJMSExceptionAndThrow(DispatcherAdapter.java:110)
        at weblogic.jms.dispatcher.DispatcherAdapter.dispatchSyncTran(DispatcherAdapter.java:53)
        at weblogic.jms.client.JMSProducer.toFEProducer(JMSProducer.java:1300)
        at weblogic.jms.client.JMSProducer.deliveryInternal(JMSProducer.java:807)
        at weblogic.jms.client.JMSProducer.sendInternal(JMSProducer.java:543)
        at weblogic.jms.client.JMSProducer.sendWithListener(JMSProducer.java:394)
        at weblogic.jms.client.JMSProducer.send(JMSProducer.java:384)
        at weblogic.jms.client.WLProducerImpl.send(WLProducerImpl.java:970)
        at org.apache.jmeter.protocol.jms.sampler.FixedQueueExecutor.sendAndReceive(FixedQueueExecutor.java:87)
        at org.apache.jmeter.protocol.jms.sampler.JMSSampler.sample(JMSSampler.java:151)
        at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429)
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
        at java.lang.Thread.run(Thread.java:744)
Caused by: weblogic.jms.common.JMSSecurityException: Access denied to resource: type=<jms>, application=ppit-jms-module, destinationType=queue, resource=Sebula.Prepaid.Asynch.Request, action=send
        at weblogic.utils.StackTraceDisabled.unknownMethod()
Caused by: weblogic.jms.common.JMSSecurityException: Access denied to resource: type=<jms>, application=ppit-jms-module, destinationType=queue, resource=Sebula.Prepaid.Asynch.Request, action=send
        ... 1 more
Caused by: weblogic.jms.common.JMSSecurityException: Access denied to resource: type=<jms>, application=ppit-jms-module, destinationType=queue, resource=Sebula.Prepaid.Asynch.Request, action=send
        ... 1 more

The solution is to close the InitialContext in threadFinished instead. A patch is attached.

(Running against a JMS-queue on Weblogic 12.1.2)
Comment 1 Philippe Mouawad 2014-08-22 21:13:08 UTC
Date: Fri Aug 22 21:11:17 2014
New Revision: 1619932

URL: http://svn.apache.org/r1619932
Log:
Bug 56809 - JMSSampler closes InitialContext too early
Bugzilla Id: 56809

Modified:
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java
    jmeter/trunk/xdocs/changes.xml
Comment 2 Philippe Mouawad 2014-08-22 21:13:23 UTC
Thanks for contribution.
Comment 3 The ASF infrastructure team 2022-09-24 20:37:57 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3409