You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by bu...@apache.org on 2008/07/22 16:38:22 UTC

DO NOT REPLY [Bug 45458] New: Point to Point JMS in combination with authentication

https://issues.apache.org/bugzilla/show_bug.cgi?id=45458

           Summary: Point to Point JMS in combination with authentication
           Product: JMeter
           Version: 2.3.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
        AssignedTo: jmeter-dev@jakarta.apache.org
        ReportedBy: ronald.van.de.kuil@nl.ibm.com


sebb <se...@gmail.com> 

The JMS Publisher and Subscriber sampler GUIs both have
Username/Password fields which are used by the samplers; however for
some reason the JMS Point to Point GUI does not.

I've no idea why that is so - perhaps it was an oversight.

I suggest someone creates a Bugzilla issue asking for these fields to
be added to the GUI and the sampler. [Unfortunately the GUI is already
very full, but I guess that can be rearranged a bit]

Note RKU:

  I have got the authentication working with IBM MQSeries using the JMS
  Point to Point sampler.

  I modified the code as follows:

  In the class org.apache.jmeter.protocol.jms.sampler.JMSSampler I have
  added 2 methods:

    /**
     * RKU: get us the user
     *
     * @param context
     * @return
     * @throws NamingException
     */
    private String getUser(Context context) throws NamingException{
            Hashtable env = context.getEnvironment();
            return (String) env.get("java.naming.security.principal");
    }

    /**
     * RKU: get us the password
     *
     * @param context
     * @return
     * @throws NamingException
     */
    private String getPassword(Context context) throws NamingException{
            Hashtable env = context.getEnvironment();
            return (String) env.get("java.naming.security.credentials");
    }

In the same class I have replaced the line that creates the queue connection in
the method threadStarted() of the same class:

if (null != getUser(context) && null != getPassword(context)){
     System.out.println("explicit user and password");
     connection = factory.createQueueConnection(
                          getUser(context), 
                          getPassword(context));
}else{
     System.out.println("without explicit authentication");
     connection = factory.createQueueConnection();
}

Perhaps IBM MQSeries uses different properties for the user and the password
but I am not very knowledgeable in this area.

The following link suggests that the used properties are correct for MQ series:
http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-connect-to-mqseries/doc/how-to-connect-to-mqseries.html#env

If anyone wants to reproduce this then you should know the following:

- use the com.sun.jndi.fscontext.RefFSContextFactory class as initial
context factory with a url to the JNDI repository;
- use IBM JMSAdmin tool to create a JNDI mapping between your JMS world
and the MQ world in your JNDI repository;

And of course you will have to add the ibm mq jars to the lib directory of
jmeter.

JAR              Obtained via
mail.jar         jmeter site
activation.jar   jmeter site
com.ibm.mq.jar   MQ installation
com.ibm.mqjms.jar       MQ installation
connector.jar    MQ installation
dhbcore.jar      MQ installation
fscontext.jar    MQ installation
jms.jar          MQ installation
jta.jar          MQ installation
providerutil.jar MQ installation
mqcontext.jar    support pac ME01
com.ibm.mq.pcf-6.0.3.jar support pac MS0B


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 45458] Point to Point JMS in combination with authentication

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45458


Sebb <se...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #4 from Sebb <se...@apache.org>  2008-11-06 16:20:54 PST ---
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 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=712018 ).

Just in case the changes cause a problem, users can set the property:

JMSSampler.useSecurity.properties=false


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 45458] Point to Point JMS in combination with authentication

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45458


Ronald van de Kuil <ro...@nl.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ronald.van.de.kuil@nl.ibm.co
                   |                            |m




--- Comment #3 from Ronald van de Kuil <ro...@nl.ibm.com>  2008-08-04 01:49:59 PST ---
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.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 45458] Point to Point JMS in combination with authentication

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45458


Ronald van de Kuil <ro...@nl.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW




--- Comment #2 from Ronald van de Kuil <ro...@nl.ibm.com>  2008-07-23 02:37:22 PST ---
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.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 45458] Point to Point JMS in combination with authentication

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45458


Sebb <se...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




--- Comment #1 from Sebb <se...@apache.org>  2008-07-22 09:56:23 PST ---
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.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org