Summary: | Point to Point JMS in combination with authentication | ||
---|---|---|---|
Product: | JMeter - Now in Github | Reporter: | Ronald van de Kuil <ronald.van.de.kuil> |
Component: | Main | Assignee: | JMeter issues mailing list <issues> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ronald.van.de.kuil |
Priority: | P2 | ||
Version: | 2.3.2 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows XP |
Description
Ronald van de Kuil
2008-07-22 07:38:21 UTC
Are there any circumstances where the properties need to be set differently for the context compared to values used in the QueueConnection? If not, then the solution seems OK, otherwise perhaps the GUI needs separate fields for them. I am not really sure. The properties java.naming.security.principal and java.naming.security.credentials are intended for a vendor neutral approach for specifying a user and a password as far as I know. A safer solution would probably be to add a user and password textfield to the panel and call factory.createQueueConnection with an explicit user and password when the textfields have filled. This would also be more user friendly. The code suggested on 2008-07-22 07:38 works for the RequestOnly sampler. For the RequestResponse sampler I had to change the receiver as well. I made the following changes: In the class org.apache.jmeter.protocol.jms.sampler.Receiver I modified the 2 of its methods as follows: private Receiver(QueueConnectionFactory factory, Queue receiveQueue, String aUser, String aPassword) throws JMSException { if (null != aUser && null != aPassword) { log.info("creating receiver WITH authorisation credentials"); conn = factory.createQueueConnection(aUser, aPassword); }else{ log.info("creating receiver without authorisation credentials"); conn = factory.createQueueConnection(); } session = conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); consumer = session.createReceiver(receiveQueue); log.debug("Receiver - ctor. Starting connection now"); conn.start(); log.info("Receiver - ctor. Connection to messaging system established"); } public static synchronized Receiver createReceiver(QueueConnectionFactory factory, Queue receiveQueue, String aUser, String aPassword) throws JMSException { // if (receiver == null) { Receiver receiver = new Receiver(factory, receiveQueue, aUser, aPassword); Thread thread = new Thread(receiver); thread.start(); // } return receiver; } In short, I added the user name and password and logic to use it. In the org.apache.jmeter.protocol.jms.sampler.JMSSampler class I made the following change in the method threadStarted() if (!useTemporyQueue()) { receiveQueue = (Queue) context.lookup(getReceiveQueue()); receiverThread = Receiver.createReceiver(factory, receiveQueue, getUser(context), getPassword(context)); } This works for us here, we tested it this morning. Thanks for the patches. I've committed the changes to SVN: URL: http://svn.apache.org/viewvc?rev=712018&view=rev Log: Bug 45458 - Point to Point JMS in combination with authentication so the code will be in nightly builds after r712018. Just in case the changes cause a problem, users can set the property: JMSSampler.useSecurity.properties=false This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2138 |