Bug 51691 - Authorization does not work for JMS Publisher and JMS Subscriber
Authorization does not work for JMS Publisher and JMS Subscriber
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.5.1
All All
: P2 critical (vote)
: ---
Assigned To: JMeter issues mailing list
:
: 51667 (view as bug list)
Depends on: 51996
Blocks:
  Show dependency tree
 
Reported: 2011-08-19 18:37 UTC by Yaroslav
Modified: 2012-01-15 13:43 UTC (History)
2 users (show)



Attachments
JMS Subscriber screenshot (128.01 KB, image/jpeg)
2011-09-14 21:08 UTC, Yaroslav
Details
Test JMX (6.81 KB, application/xml)
2011-09-17 20:46 UTC, Philippe Mouawad
Details
Fix to the issue (6.83 KB, patch)
2011-09-17 20:51 UTC, Philippe Mouawad
Details | Diff
jmeter log (7.26 KB, application/octet-stream)
2011-10-08 00:08 UTC, Yaroslav
Details
Test Plan screenshot (125.67 KB, image/jpeg)
2011-10-08 00:08 UTC, Yaroslav
Details
activemq conf files (16.18 KB, application/x-zip-compressed)
2011-10-08 17:05 UTC, Yaroslav
Details
jmeter test plan (12.00 KB, application/octet-stream)
2011-10-08 17:06 UTC, Yaroslav
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yaroslav 2011-08-19 18:37:16 UTC
I've already reported the issue long time ago. Now I don't see that issue in the list :(

The problem is that when I'm using Authentication feature with JMS Publisher sample (ON "Use Authorization?" checkbox, with correct user/password) - the sample will fail with the error = "User name or password is invalid".

Below is BeanShell sample that work fine with Authentication for the same JMS server.
So, this is my proving that it is JMeter issue (means JMS Publisher sample).

I believe that the issue is valid for JMS Subscriber as well.

Workaround - disabling Authentication on JMS server.
============

import javax.jms.ConnectionFactory;
import javax.jms.Connection;
import javax.jms.Session;
import javax.jms.MessageProducer;
import javax.jms.MessageConsumer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.Message;
import javax.jms.TextMessage;
//Import the classes to use JNDI.
import javax.naming.*;
import java.util.*;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQQueue;

System.out.println("TEST");
                                    String myhostname = "tcp://mdmcdocr-esbqa.mcgov.org:61616";
                                    ConnectionFactory factory = new ActiveMQConnectionFactory(myhostname);

                                   connection = factory.createConnection("user", "password");
//                                   connection = factory.createConnection();
                                   session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                                   queue = session.createQueue("Elite_To_MorphoTrak");
                                   MessageConsumer consumer = session.createConsumer(queue,"JMSCorrelationID='e884b430-c9fb-11e0-9279-79bc5a87f8d4'");
  
                                    connection.start();
System.out.println("TEST 2");
                                    Message myMessage = consumer.receive(2000);
System.out.println("TEST 3");
                                    session.close(); 
                                    connection.close();
System.out.println("TEST 4");
//                TextMessage txtMsg = (TextMessage) myMessage;
//                System.out.println("Read Message: " + txtMsg.getText());
                System.out.println("Read Message: " + myMessage);
System.out.println("TEST 6");
Comment 1 Philippe Mouawad 2011-09-07 20:13:37 UTC
Hello,
Can you post your JMX file.
Are you sure you set JNDI properties for user and password ?

Regards
Philippe Mouawad
Comment 2 Yaroslav 2011-09-14 21:08:08 UTC
Created attachment 27496 [details]
JMS Subscriber screenshot
Comment 3 Yaroslav 2011-09-14 21:09:32 UTC
I do not use "JNDI Properties" flag.
See attached screenshot.
Comment 4 Philippe Mouawad 2011-09-17 20:46:52 UTC
Created attachment 27522 [details]
Test JMX

Scenario that shows the issue.
It works with ActiveMQ:
It requires setting in credentials-enc.properties:
activemq.username=system
activemq.password=ENC(bNDG0WY3R49MCylXtUWfGW1SAy563g6E)
guest.password=ENC(bNDG0WY3R49MCylXtUWfGW1SAy563g6E)

And using activemq-security.xml and changing:
<authenticationUser username="system" password="${activemq.password}"
                    groups="users,admins"/>

And starting it with:
export ACTIVEMQ_ENCRYPTION_PASSWORD=activemq
/activemq start xbean:conf/activemq-security.xml
Comment 5 Philippe Mouawad 2011-09-17 20:51:57 UTC
Created attachment 27523 [details]
Fix to the issue

Hello,
Here is the fix, it fixes the following issues related to this:
1) Issue in JMS Subscriber and JMS Publisher with the checkbox, when "Use Authorization" is checked User name and password are disabled (which is wrong) => I fixed it
2) Issue in Utils where createConnection was not called with user/password => That's why it didn't work
3) Issue if you have a mix of Authenticated connection and not


Regards
Philippe Mouawad
Comment 6 Sebb 2011-09-17 22:09:03 UTC
Thanks again!

Fix applied:

URL: http://svn.apache.org/viewvc?rev=1172077&view=rev
Log:
Bug 51691 - Authorization does not work for JMS Publisher and JMS Subscriber

Modified:
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/Utils.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/InitialContextFactory.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSSubscriberGui.java
   jakarta/jmeter/trunk/xdocs/changes.xml
Comment 7 Philippe Mouawad 2011-09-18 08:38:11 UTC
*** Bug 51667 has been marked as a duplicate of this bug. ***
Comment 8 Yaroslav 2011-10-08 00:04:32 UTC
Jmeter 2.5.1 (r1177103)

Simple TP - just one "JMS Subscriber" sample (see YH1168.jpg attached).

Run from GUI produces "NullPoinerException" error - see jmeter.log attached;

I'm using activemq-all-5.3.1.jar (attached). The file has to be placed into "lib\ext" directory.

So, the issue is reopened.

Question: why activemq-all-5.3.1.jar has to be placed into "lib\ext" rather than just into "lib" directory?
Comment 9 Yaroslav 2011-10-08 00:08:13 UTC
Created attachment 27734 [details]
jmeter log
Comment 10 Yaroslav 2011-10-08 00:08:52 UTC
Created attachment 27735 [details]
Test Plan screenshot
Comment 11 Yaroslav 2011-10-08 00:10:56 UTC
Sorry cannot attach activemq-all-5.3.1.jar due to size-limiting.
Comment 12 Philippe Mouawad 2011-10-08 06:58:10 UTC
Please attach:
- activemq configuration files, no need for jar
- test plan not just screenshot 
- any file you use in test plan

Thank you
Comment 13 Philippe Mouawad 2011-10-08 07:53:59 UTC
Also try to replace in your test variables by their real values to exclude any misloading of CVS.

Test against ActiveMQ5 is OK for me with one subscriber as in your Test Plan.
Regards
Philippe
Comment 14 Yaroslav 2011-10-08 16:29:24 UTC
Hi Philippe,

1) why do you ask for activemq files if the java-code in Description works fine; NP, I will provide;
2) it does not work when I provide user/password by their values;
3) Jmeter 2.4 provides handled-error that user/paswword is not correct;
Comment 15 Yaroslav 2011-10-08 17:04:38 UTC
1) activemq conf files are attached (some security files are not included);
2) TP is attached;
3) TP is simplified and does not use any data files;
4) TP is updated to not use variables;
Comment 16 Yaroslav 2011-10-08 17:05:37 UTC
Created attachment 27739 [details]
activemq conf files
Comment 17 Yaroslav 2011-10-08 17:06:20 UTC
Created attachment 27740 [details]
jmeter test plan
Comment 18 Yaroslav 2011-10-08 17:08:04 UTC
Once again, the java-code provided in the description works fine with my activemq configuration (username and password need to change).
Comment 19 Philippe Mouawad 2011-10-08 18:07:56 UTC
I reproduced NPE with your test case.
Regarding your question, you can put libraries in lib also.

Issue has been fixed in trunk by fixing 51996.
But your test plan also enabled me to see a NPE that occurs when user/password is wrong, fix will be available within minutes.

So thank you very much.
Regards
Philippe
Comment 20 Philippe Mouawad 2011-10-08 19:03:05 UTC
(In reply to comment #19)
> I reproduced NPE with your test case.
> Regarding your question, you can put libraries in lib also.
> 
> Issue has been fixed in trunk by fixing 51996.

Start Of wrong comment
> But your test plan also enabled me to see a NPE that occurs when user/password
> is wrong, fix will be available within minutes.
> 
Ignore from "Start Of wrong comment" 
> So thank you very much.
> Regards
> Philippe
Comment 21 Philippe Mouawad 2011-10-08 19:06:54 UTC
Date: Sat Oct  8 19:06:06 2011
New Revision: 1180462

URL: http://svn.apache.org/viewvc?rev=1180462&view=rev
Log:
Bug 51691 - Authorization does not work for JMS Publisher and JMS Subscriber

Adding some comments just to clarify why 51996 fix fixes this NPE issue

Modified:
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/InitialContextFactory.java
   jakarta/jmeter/trunk/xdocs/changes.xml
Comment 22 Philippe Mouawad 2011-10-09 10:03:26 UTC
Hello Yaroslav,
You can test if fix is OK by getting ,nightly build at:
https://builds.apache.org/job/JMeter-trunk/lastSuccessfulBuild/artifact/trunk/dist/

Regards
Philippe
Comment 23 Yaroslav 2011-10-14 19:46:38 UTC
Verified r1183374

The issue has been passed QA
Comment 24 Philippe Mouawad 2012-01-15 13:43:09 UTC
Thanks for verification.
Marking issue as RESOLVED to avoid it appearing in Bug Report.