Author |
Message
|
melsom |
Posted: Thu Nov 02, 2006 6:21 am Post subject: Using JMS to send messages to MQ - setting userid field |
|
|
Newbie
Joined: 02 Nov 2006 Posts: 8
|
Hi
I am running an application on Tomcat and want to send messages to an MQ Queue running on an MQ server running unix. MQ Client 5.3 is installed on my computer running win 2000.
I can send a message to the queue and the message is picked up (by JMS), but the userid field of the message is set to mqm. If I use MQ API I can set the userid of the message to what I want, but how can I set the userid and password field of the message when I send the message by JMS?
I have tried using queueconnectionfactory.createQueueConnection(user,passwd) but it does not work. When I use the session to create a textmessage and use getStringProperty("JMSXUserID") I can see that this property still is null. When I browse the queue I can see that the userid is set to MQM when the message reaches the queue.
Thanks! |
|
Back to top |
|
 |
RogerLacroix |
Posted: Thu Nov 02, 2006 9:15 am Post subject: Re: Using JMS to send messages to MQ - setting userid field |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
melsom wrote: |
getStringProperty("JMSXUserID") |
Incorrect method.
melsom wrote: |
queueconnectionfactory.createQueueConnection(user,passwd) |
Correct method.
melsom wrote: |
that the userid is set to MQM |
Check to made sure someone didn't set the channel's MCAUSER attribute to 'mqm'.
Regards,
Roger Lacroix _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
melsom |
Posted: Thu Nov 02, 2006 9:19 am Post subject: |
|
|
Newbie
Joined: 02 Nov 2006 Posts: 8
|
Hi
How can I check that the channels MCAUSER to MQM?
Thanks for your reply. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Nov 02, 2006 9:20 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Use the DISPLAY CHANNEL command as laid out in the Command Reference manual (or online equivalent) _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
melsom |
Posted: Thu Nov 02, 2006 9:25 am Post subject: |
|
|
Newbie
Joined: 02 Nov 2006 Posts: 8
|
Thank you!
Will check this tomorrow as I am home and the clock is 6:30 pm here now.
If the MCAUSER is set to MQM, what will be the appropriate way to change it and what should I change it to? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Nov 02, 2006 9:47 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
ALTER CHANNEL.
And set it to blank. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
melsom |
Posted: Thu Nov 02, 2006 10:47 am Post subject: |
|
|
Newbie
Joined: 02 Nov 2006 Posts: 8
|
You got me thinking...
If the channels MCAUSER was set to MQM. Why does the message arrive at the queue with the userid set to my username (and not mqm) when I use MQ API and use mqmessage.userId="username" in the code?
That is it works when I use MQ API but not when I use JMS API. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Nov 02, 2006 3:43 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
JMS API allows you to specify a userid ONLY in CLIENT bindings.
If you are in SERVER bindings the userid running the JVM is used.
The proper way to specify a user id in JMS is:
Connection myconn = qcf.createConnection(usrid, passwd);
Any mcauser settings on the SVRCONN channel used, or on any other channel used, before the message hits the queue may and will supersede the userid passed in the connection.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
melsom |
Posted: Fri Nov 03, 2006 2:13 am Post subject: |
|
|
Newbie
Joined: 02 Nov 2006 Posts: 8
|
Thank you! I now get a
javax.jms.JMSSecurityException: MQJMS2013: invalid security authentication supplied for MQQueueManager
Is this because the userid passed to the createConnection-method is not at authorised for the queuemanager at the box running it, or is it the user I use to run my JVM at the client-side which is not authorised? |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Nov 03, 2006 3:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
It's because the UserId supplied in the client connection has not rights to MQ on the server machine. That userid must authenticate on the MQ Server.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
melsom |
Posted: Fri Nov 03, 2006 5:01 am Post subject: |
|
|
Newbie
Joined: 02 Nov 2006 Posts: 8
|
Thanks! I now get the correct userid on the message on the queue.
In MQ API I also set the applicationIdData field to the password for the user. I can see that the mqmessage.applicationIdData field in MQMD is not mapped to any JMS property. When I set this password in the createConnection(user,passwd) method the logon failes on the password. Is this the correct way to set the passwd?
What limitations are there one the password? I have looked in the docs but cannot find it anywhere..
Since the applicationIdData field is not mapped to any property in JMS, and the system I am going to send messages to requires the password in applicationIdData; am I stuck with MQ API here?  |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Nov 03, 2006 2:46 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
melsom wrote: |
In MQ API I also set the applicationIdData field to the password for the user. I can see that the mqmessage.applicationIdData field in MQMD is not mapped to any JMS property. When I set this password in the createConnection(user,passwd) method the logon failes on the password. Is this the correct way to set the passwd? What limitations are there one the password? I have looked in the docs but cannot find it anywhere..
|
I don't know if the password gets checked with V6. In V5 the password did not get checked. Anyways if a password does get checked it probably gets checked against the MQServer System so the account/password rules for that system would apply. Can't remember if there is a limitation about the passwd but the max for the userid used to be 12 chars.
melsom wrote: |
Since the applicationIdData field is not mapped to any property in JMS, and the system I am going to send messages to requires the password in applicationIdData; am I stuck with MQ API here?  |
Again you have given us very little information to go by and you may just be going off in a direction that is not the intended way... You do not specify what that application is...
If you are talking about a CICS bridge or IMS bridge you might want to investigate the MappingMessage. Otherwise looks like you are SOL.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
melsom |
Posted: Sat Nov 04, 2006 2:02 am Post subject: |
|
|
Newbie
Joined: 02 Nov 2006 Posts: 8
|
Hi
Tkanks for your reply.
The connection to MQServer system is ok. I get connected there and the message is sent and I get a reply from the system I am going to connect to. The logon I am referring to is the logon on the system I am going to send messages to. It is a financial system, but I do not know what platform/technology it is implemented on.
This system uses the userId field for username and applicationIdData for password in its logon mechanism. I have found that createConnection(user, password) sets the user in the userId field, but I am now struggeling with the applicationIdData field. As this field is not mapped in the mapping between JMS and MQMD fields I wonder if I am stuck using MQ-API for sending messages to this system?
As I am going to receive messages async from this system via a JMS-listener I would like to use this API for sending messages as well.. |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Nov 04, 2006 5:49 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
That remote system is WRONG.
ApplicationID should not be used to hold Business Data, like a Password.
You will need to Set Context to be able to set the Application ID.
You will almost certainly not be able to do this with JMS and will have to do this with the WebSphere MQ API for Java. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Nov 04, 2006 5:55 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You need to get more information on the partner system. If it uses the CICS Bridge you may be able to use the mapping message. Otherwise it looks like you are stuck replying with the MQ Base API.
If you need to send JMS messages without the RFH header just specify it in the JNDI (targetClient=MQ) or when creating the destination: queue://myqmgr/myqueuename?targetClient=1...
On V6 you have a property of the qcf: targetClientMatching (true by default).
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|