Author |
Message
|
lcsysoa |
Posted: Fri Jan 18, 2008 2:41 pm Post subject: Remote cluster queue not found (JNDI) |
|
|
Newbie
Joined: 18 Jan 2008 Posts: 9
|
I have a cluster of two MQ servers (v 6) with each their QMs. I created the queue Q1 on QM1
DEFINE QLOCAL(Q1) CLUSTER(QCLUS)
I can see Q1 from QM2 ok:
dis queue(*) clusinfo
...
AMQ8409: Display Queue details.
QUEUE(Q1) TYPE(QCLUSTER)
Unfortunately, in my JMS application, I can't see Q1 when I connect to QM2 (which is critical here). I just want to PUT to this remote cluster queue.
My JMS application uses:
Initial context factory class name: com.ibm.mq.jms.context.WMQInitialContextFactory
JNDI URL: 10.0.1.195:1414/SYSTEM.AUTO.SVRCONN
Queue Connection Factory Name: MQ2
Queue Name: Q1
The error I get is:
javax.naming.NameNotFoundException: Object Q1 not found on queue manager QM2
Fine, I then tried creating a local alias for Q1:
DEFINE QALIAS(Q1ALIAS) TARGQ(Q1)
Then I use Queue Name 'Q1ALIAS' instead of Q1 in my app. In that case, I get the error
javax.jms.InvalidDestinationException: MQJMS2008: failed to open MQ queue
at com.ibm.mq.jms.MQQueueSession.getQueueOpenException(MQQueueSession.java:925)
at com.ibm.mq.jms.MQQueueSession.getOutputQueue(MQQueueSession.java:866)
at com.ibm.mq.jms.MQQueueSession.createSender(MQQueueSession.java:206)
I read something about having to create a QREMOTE but I don't understand why and what the exact syntax would be.
DEFINE QREMOTE(WHATEVER) RNAME(' ') RQMNAME(' ') ??
Any suggestions welcome. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Sat Jan 19, 2008 5:07 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
|
Back to top |
|
 |
lcsysoa |
Posted: Sat Jan 19, 2008 7:40 pm Post subject: |
|
|
Newbie
Joined: 18 Jan 2008 Posts: 9
|
Thanks for your reply Peter Potkay,
If I understand correctly, you suggest I add a definition like
DEFINE Q(FOO) QUEUE(Q1)
from the QM2 node and refer to the queue name FOO on that queue manager.
Did I get this right? |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Jan 19, 2008 11:17 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Did you specify a qmgr in your JNDI definition of Q1?
If you did you shouldn't have. Leave the field blank.
Alternative: specify a cluster alias as the qmgr for the JNDI definition of Q1:
Code: |
def qr(myclusalias) defbind(notfixed) |
Then setup the JNDI for Q1 as queue=Q1 qmgr=MYCLUSALIAS...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
lcsysoa |
Posted: Mon Jan 21, 2008 11:22 am Post subject: |
|
|
Newbie
Joined: 18 Jan 2008 Posts: 9
|
Thanks for your reply I added the QREMOTE definition on my MQ2 instance as you suggested
DEFINE QREMOTE(myclusalias) DEFBIND(notfixed)
And I changed the JNDI settings to:
JNDI URL: 10.0.1.195:1414/SYSTEM.AUTO.SVRCONN
Queue Connection Factory Name: myclusalias
Queue Name: Q1
(I used to refer to the queue manager for the connection factory name so now i refer to this new MYCLUSALIAS)
The problem now is that when I do the jndiContext.lookup with this new definition, I get an object of type com.ibm.mq.jms.MQQeue whereas I would previously expect a ConnectionFactory which would be used for creating the jms Connection and Session objects.
Last edited by lcsysoa on Mon Jan 21, 2008 11:41 am; edited 2 times in total |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jan 21, 2008 11:28 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Code: |
def qr('myclusalias') defbind(notfixed) |
or use MYCLUSALIAS in JNDI
case-sensitive. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
lcsysoa |
Posted: Mon Jan 21, 2008 12:06 pm Post subject: |
|
|
Newbie
Joined: 18 Jan 2008 Posts: 9
|
Properties props = new Properties();
props.put(Context.PROVIDER_URL, "10.0.1.195:1414/SYSTEM.AUTO.SVRCONN");
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.mq.jms.context.WMQInitialContextFactory");
props.putAll(connection.properties() );
Context jndiContext = new InitialContext(props);
Object o = jndiContext.lookup("MYCLUSALIAS");
o here is of instance MQQeue, how do i get Connection and Session from that?
Previously, i would put QM2 here (the queue manager of the node i was connecting to). I would then get something that would be instantiable to ConnectionFactory which would be used to create the Session which would in turn be used to create the message to put (session.createTextMessage(...))
How do i create my session now? Do i still use QM2 as before? If so, how do i use "MYCLUSALIAS" in my code? |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jan 21, 2008 12:09 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You missed the point.
You keep Q1 as your q name and your qname. You put MYCLUSALIAS as the QMNAME on the Q Destination.
And you leave your QCF the same. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
lcsysoa |
Posted: Mon Jan 21, 2008 1:33 pm Post subject: |
|
|
Newbie
Joined: 18 Jan 2008 Posts: 9
|
I guess the reason this confuses me is that I never used the queue manager name for getting the queue in the first place. I only use the queue manager name when getting the ConnectionFactory.
I get the queue using the call jndiContext.lookup("Q1");
This works well for local queues but causes the NameNotFoundException when I try to access the remote cluster queue.
I don't see where I'm supposed to use "MYCLUSALIAS" anywhere in my code. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jan 21, 2008 1:35 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You don't put it anywhere in your code.
You put it in the JNDI definition of the Queue Destination. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
lcsysoa |
Posted: Mon Jan 21, 2008 3:15 pm Post subject: |
|
|
Newbie
Joined: 18 Jan 2008 Posts: 9
|
Thanks,
When you say
[quote]You put it in the JNDI definition of the Queue Destination[/quote]
I presume you are referring to the JMSAdmin utility to create JNDI references that go in LDAP for example. I've been using Me01 until now as per my initial context factory class name.
Am I hitting a limitation of me01? Should I use JMSAdmin instead to allow my JMS client to put to a remote cluster queue. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jan 21, 2008 5:45 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
DON'T EVER USE ME01 as JNDI provider.
It is a quick way to run into problems:
- the implementation is dynamic and retrieves its information through pcf messages from the qmgr
- as you have noticed this carries some limitations
- prevents multiple indirections
- prevents CCSID JNDI assignments
- don't know if it allows for attribute qualifiers such as targetClient
If you are working in pojo use the filesystem JNDI provided by sun (included in your MQ software)
If you are working with WAS use the WAS JMS MQ setup
If you are working with an other application server use the resource adapter and version 6.0.2.2 or higher.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
lcsysoa |
Posted: Tue Jan 22, 2008 4:28 pm Post subject: |
|
|
Newbie
Joined: 18 Jan 2008 Posts: 9
|
Thanks guys,
This is working great. I like the simple solution where you simply declare the JNDI reference without specifying the qmgr argument:
Code: |
def q(QREMOTECLUSTER) queue(Q1) |
very simple, very effective
the other method where you declare a qremote with defbind(notfixed) and use that in lieu of the qmgr value in the JNDI q definition also works great.
Thanks again, i'll stay away from me01 from now on. |
|
Back to top |
|
 |
|