aspose file tools*
The moose likes Websphere and the fly likes JNDI Lookup can't find MQ QCF.  Why?!? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "JNDI Lookup can Watch "JNDI Lookup can New topic
Author

JNDI Lookup can't find MQ QCF. Why?!?

Jeff Stickel
Greenhorn

Joined: Jan 18, 2005
Posts: 3
Hello all.

I'm relatively new to WebSphere, so pardon my ignorance if it is apparent.

I've created a WS MQ Connection Factory from the WS MQ JMS Provider page. I used all of the default settings, other than the name (autopolicyQCF) and the JNDI name, which I named identically (autopolicyQCF). Note that it was created under the scope of "Server", as opposed to Cell or Node.

Easy enough, right? Next, I wrote a simple, standalone, non-J2EE client that I'm using to lookup my qcf. No matter what I try, I can't seem to find my QCF. I've burned about 2 days trying to figure this out, and my Google searches haven't yielded much more than a list of people who are frustraed with trying to do the same thing. Oh, and I tried the same client with a normal WebSphere JMS Provider, but got the same results.

Any help you can give is greatly appreciated, either through this posting or my email address (JeffreyStickel@fairisaac.comm). Thanks!!

Here is the run() method of my class:

public void run() {

// Set up config for Initial Context
Properties props = new Properties();
props.put( Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory" );
props.put( Context.PROVIDER_URL, "corbaloc:iiop:localhost:2809");


// Get Initial Context for resource lookup;
InitialContext ctx = null;
try {
ctx = new InitialContext( props );
System.out.println( "Have context: " + ctx.getNameInNamespace() );
}
catch( NamingException e ) {
System.out.println( e );
return;
}


// Get Establish a QueueConnectionFactory for connecting to reply/response queues
// Lookup fails on all names unless otherwise specified in my // comments.
String resourceName = "java:comp/env/autopolicyQCF"; // Fails for non-J2EE Client
resourceName = "jms/autopolicyQCF";// Fails
resourceName = "JMS/autopolicyQCF";// Fails
resourceName = "JEFFSTICKEL";// Fails
resourceName = "cell/nodes/JEFFSTICKEL/servers/server1/JMS/autopolicyQCF"; // Fails
resourceName = "nodes/JEFFSTICKEL/servers/server1";// Fails
resourceName = "JMS/mq/EmployeeDetailsQcf";// Fails
resourceName = "DefaultDatasource";// This one works.
resourceName = "cell/nodes/JEFFSTICKEL/servers/server1"; // This one works.
resourceName = "autopolicyQCF";// Fails

try {
Object obj = ctx.lookup( resourceName ) ;
System.out.println( "Have resource " + resourceName + " of type " + obj.getClass().getName() );
} catch (Exception ex) {
System.out.println( "Unable to lookup resource: " + resourceName + ": " + ex);
ex.printStackTrace();
}
}


... and here is the output.
Have context: JEFFSTICKEL/nodes/JEFFSTICKEL/servers/server1
javax.naming.NameNotFoundException: Context: JEFFSTICKEL/nodes/JEFFSTICKEL/servers/server1, name: ejb/AutoPolicyRulesServer: First component in name AutoPolicyRulesServer not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound
Unable to lookup resource: ejb/AutoPolicyRulesServer: javax.naming.NameNotFoundException: Context: JEFFSTICKEL/nodes/JEFFSTICKEL/servers/server1, name: ejb/AutoPolicyRulesServer: First component in name AutoPolicyRulesServer not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound]
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:48)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3491)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1519)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1480)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1187)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1067)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at com.fi.kahg.policydata.AutoPolicyTestClient.run(AutoPolicyTestClient.java:67)
at com.fi.kahg.policydata.AutoPolicyTestClient.main(AutoPolicyTestClient.java:80)


" I believe that the man who works the hardest is the man who deserves to win."<br /> <br />-- Lance Armstrong, upon winning his 6th Tour de France
Roland Barcia
author
Ranch Hand

Joined: Apr 15, 2004
Posts: 181
My white paper explains the different configurations:

http://www-106.ibm.com/developerworks/websphere/library/techarticles/0310_barcia/barcia.html


Roland Barcia: IBM Distinguished Engineer, CTO Mobile for Lab Services
Jeff Stickel
Greenhorn

Joined: Jan 18, 2005
Posts: 3
Ok, so I learned a bit from last night. Looks like my use of the WebSphere MQ JMS Provider was for embedded messaging only, i.e. the messaging within WebSphere only. I apparently need to use WebSphere MQ for more extensive messaging.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI Lookup can't find MQ QCF. Why?!?