ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Remote cluster queue not found (JNDI)

Post new topic  Reply to topic
 Remote cluster queue not found (JNDI) « View previous topic :: View next topic » 
Author Message
lcsysoa
PostPosted: Fri Jan 18, 2008 2:41 pm    Post subject: Remote cluster queue not found (JNDI) Reply with quote

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
View user's profile Send private message
PeterPotkay
PostPosted: Sat Jan 19, 2008 5:07 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

http://www.mqseries.net/phpBB2/viewtopic.php?t=41420
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
lcsysoa
PostPosted: Sat Jan 19, 2008 7:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Sat Jan 19, 2008 11:17 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
lcsysoa
PostPosted: Mon Jan 21, 2008 11:22 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 21, 2008 11:28 am    Post subject: Reply with quote

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
View user's profile Send private message
lcsysoa
PostPosted: Mon Jan 21, 2008 12:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 21, 2008 12:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
lcsysoa
PostPosted: Mon Jan 21, 2008 1:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 21, 2008 1:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
lcsysoa
PostPosted: Mon Jan 21, 2008 3:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Jan 21, 2008 5:45 pm    Post subject: Reply with quote

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:
  1. the implementation is dynamic and retrieves its information through pcf messages from the qmgr
  2. as you have noticed this carries some limitations
  3. prevents multiple indirections
  4. prevents CCSID JNDI assignments
  5. 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
View user's profile Send private message Send e-mail
lcsysoa
PostPosted: Tue Jan 22, 2008 4:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Remote cluster queue not found (JNDI)
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.