Author |
Message
|
friedl.otto |
Posted: Fri Feb 20, 2009 7:49 am Post subject: WMQ7 STANDARD_BINDING ... HELP! |
|
|
Centurion
Joined: 06 Jul 2007 Posts: 116
|
Right here's the trouble, I am running SLES 10 x86 64-bit, and this:
http://www-304.ibm.com/jct01005c/isv/tech/sample_code/mq/mqhash.java
... compiles and runs just fine ... USING a SVRCONN!
So I hack it down to the bare essentials, and sans decent online reference
of the new allegedly awesome MQ7 libraries failed to get STANDARD_BINDING
to work.
Code: |
import com.ibm.mq.*; // Include the MQ package
import com.ibm.mq.constants.MQConstants; // Include the WMQ constants
import java.io.*;
import java.lang.*;
public class mqhash
{
private MQQueueManager qMgr = null;
public static void main (String args[]) throws IOException
{
mqhash mySample = new mqhash();
mySample.start(args);
}
public void start(String args[])
{
try
{
MQEnvironment.connOptions = MQEnvironment.connOptions | MQConstants.MQCNO_STANDARD_BINDING;
qMgr = new MQQueueManager(args[0]);
int openOptions = MQConstants.MQOO_OUTPUT | MQConstants.MQOO_FAIL_IF_QUIESCING;
MQQueue myQueue = qMgr.accessQueue(args[1], openOptions, null, null, null);
MQMessage myMessage = new MQMessage();
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = pmo.options | MQConstants.MQPMO_FAIL_IF_QUIESCING;
myMessage.format = MQConstants.MQFMT_STRING;
myMessage.writeString("NOODLE");
myQueue.put(myMessage, pmo);
myQueue.close();
qMgr.disconnect();
}
catch (MQException ex)
{
System.out.println("An MQ error occurred: " + ex.completionCode + " " + ex.reasonCode);
}
catch (java.io.IOException ex)
{
System.out.println("Java exception: " + ex);
}
}
} |
Which yields this:
Code: |
~> echo $CLASSPATH | tr ':' '\n'
/opt/mqm/java/lib/com.ibm.mq.jar
/opt/mqm/java/lib/com.ibm.mq.jmqi.jar
/opt/mqm/java/lib/com.ibm.mq.headers.jar
/opt/mqm/java/lib/com.ibm.mq.pcf.jar
.
~> javac mqhash.java
~> java mqhash ALICE SYSTEM.DEFAULT.LOCAL.QUEUE
MQJE001: Completion Code '2', Reason '2495'.
An MQ error occurred: 2 2495 |
Google musters about three results (mostly MQRC references). PLEASE
help me understand what I should be doing!?  _________________ Here's an idea - don't destroy semaphores unless you're certain of what you're doing! -- Vitor |
|
Back to top |
|
 |
friedl.otto |
Posted: Mon Feb 23, 2009 12:35 am Post subject: |
|
|
Centurion
Joined: 06 Jul 2007 Posts: 116
|
Uhm ... anyone!? _________________ Here's an idea - don't destroy semaphores unless you're certain of what you're doing! -- Vitor |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Feb 23, 2009 5:35 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I don't have SUSE to run on... nor 64-bit linux of any sort.
I suspect that it's not a CLASSPATH issue, but a PATH kind of issue - that MQ Java can't find the C libs that it needs under the covers for Bindings connections. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Feb 23, 2009 5:45 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
I suspect that it's not a CLASSPATH issue, but a PATH kind of issue - that MQ Java can't find the C libs that it needs under the covers for Bindings connections. |
I'd check all of that, and especially that MQ_INSTALL_ROOT has been set correctly.
But your combination of WMQv7 and a 64 bit Linux platform puts you on the leading edge. So your plaintive "anyone" is likely to be realistically answered "nope, no-one".
Please post your solution when you find it.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
gunter |
Posted: Mon Feb 23, 2009 8:02 am Post subject: |
|
|
Partisan
Joined: 21 Jan 2004 Posts: 307 Location: Germany, Frankfurt
|
Search library libmqjbnd and add the folder to your library search path.
On solaris it is here:
/opt/mqm/java/lib/libmqjbnd.so
/opt/mqm/java/lib64/libmqjbnd.so
Maybe it's the same on linux. _________________ Gunter Jeschawitz
IBM Certified System Administrator - Websphere MQ, 5.3 |
|
Back to top |
|
 |
friedl.otto |
Posted: Mon Feb 23, 2009 10:00 am Post subject: |
|
|
Centurion
Joined: 06 Jul 2007 Posts: 116
|
mqjeff wrote: |
I don't have SUSE to run on... nor 64-bit linux of any sort. |
Has no-one run into this kind of poopy on any other platform using MQ7,
Java and Bindings mode?
mqjeff wrote: |
I suspect that it's not a CLASSPATH issue, but a PATH kind of issue - that MQ Java can't find the C libs that it needs under the covers for Bindings connections. |
You're making heaps of sense there ... *tries*
Code: |
export PATH="$PATH:/opt/mqm/java/lib64" |
FAIL!
vitor wrote: |
I'd check all of that, and especially that MQ_INSTALL_ROOT has been set correctly. |
Hmmm ... *tries*
Code: |
export MQ_INSTALL_ROOT="/opt/mqm" |
FAIL!
gunter wrote: |
Search library libmqjbnd and add the folder to your library search path.
On solaris it is here:
/opt/mqm/java/lib/libmqjbnd.so
/opt/mqm/java/lib64/libmqjbnd.so
Maybe it's the same on linux. |
It is indeed the same on Linux. However ... by "library search
path" I assume you mean LD_LIBRARY_PATH, of which I have
been tought:
http://prefetch.net/articles/linkers.badldlibrary.html
http://linuxmafia.com/faq/Admin/ld-lib-path.html
*tries anyway*
FAIL!
Thanks for the efforts guys, no seriously! I just find it strange
that it is such a chore ... I remember cobbling together a
bindings-mode demo app in literally minutes on MQ 6 (on the
same OS and hardware) and it was actually easier than the
often abused SVRCONN. _________________ Here's an idea - don't destroy semaphores unless you're certain of what you're doing! -- Vitor |
|
Back to top |
|
 |
manicminer |
Posted: Tue Feb 24, 2009 12:50 am Post subject: |
|
|
 Disciple
Joined: 11 Jul 2007 Posts: 177
|
Are you running a 64bit JVM? you added the 64bit lib to your path but if you are running a 32bit JVM I think you need the 32bit version.
Just another thing to check  _________________ Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. |
|
Back to top |
|
 |
gunter |
Posted: Tue Feb 24, 2009 1:21 am Post subject: |
|
|
Partisan
Joined: 21 Jan 2004 Posts: 307 Location: Germany, Frankfurt
|
I tried it on solaris and got the same error. After setting LD_LIBRARY_PATH it worked.
You have to set LD_LIBRARY_PATH to an absolute path, not relative.
ldd doesn't help to track the problem, the libraries are not linked to java, they are loaded at runtime. _________________ Gunter Jeschawitz
IBM Certified System Administrator - Websphere MQ, 5.3 |
|
Back to top |
|
 |
friedl.otto |
Posted: Tue Feb 24, 2009 3:06 am Post subject: |
|
|
Centurion
Joined: 06 Jul 2007 Posts: 116
|
manicminer wrote: |
Are you running a 64bit JVM? you added the 64bit lib to your path but if you are running a 32bit JVM I think you need the 32bit version.
Just another thing to check  |
Indeed I am:
Code: |
java -version
java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) 64-Bit Server VM (build 11.2-b01, mixed mode) |
gunter wrote: |
I tried it on solaris and got the same error. After setting LD_LIBRARY_PATH it worked.
You have to set LD_LIBRARY_PATH to an absolute path, not relative. |
ldd doesn't help to track the problem, the libraries are not linked to java, they are loaded at runtime.[/code]
I am not overly keen on using LD_LIBRARY_PATH since the bespectacled
men in white lab coats seem to agree that it is unhealthy, but here are the
results:
Code: |
~> export MQ_INSTALL_ROOT="/opt/mqm"
~> export LD_LIBRARY_PATH="/opt/mqm/java/lib64/libmqjbnd.so"
~> export CLASSPATH="/opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/java/lib/com.ibm.mq.jmqi.jar:/opt/mqm/java/lib/com.ibm.mq.headers.jar:/opt/mqm/java/lib/com.ibm.mq.pcf.jar:."
~> export PATH="$PATH:/opt/mqm/java/lib64"
~> java mqhash ALICE SYSTEM.DEFAULT.LOCAL.QUEUE
MQJE001: Completion Code '2', Reason '2495'.
An MQ error occurred: 2 2495 |
_________________ Here's an idea - don't destroy semaphores unless you're certain of what you're doing! -- Vitor
Last edited by friedl.otto on Tue Feb 24, 2009 3:18 am; edited 1 time in total |
|
Back to top |
|
 |
manicminer |
Posted: Tue Feb 24, 2009 3:13 am Post subject: |
|
|
 Disciple
Joined: 11 Jul 2007 Posts: 177
|
"apparently" the thing that is checked to find the dll is the java.library.path. You could set this using a -D option on your java call:
Code: |
-Djava.library.path=/opt/mqm/java/lib64/
|
Which would avoid you having to set the LD_LIBRARY_PATH.
Also shouldn't your LD_LIBRARY_PATH point to the directory not the library, in your output you point explicitly to libmqjbnd.so but I think that it should be the directory containing it:
Code: |
export LD_LIBRARY_PATH="/opt/mqm/java/lib64/"
|
_________________ Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. |
|
Back to top |
|
 |
friedl.otto |
Posted: Tue Feb 24, 2009 3:26 am Post subject: |
|
|
Centurion
Joined: 06 Jul 2007 Posts: 116
|
manicminer wrote: |
Which would avoid you having to set the LD_LIBRARY_PATH.
Also shouldn't your LD_LIBRARY_PATH point to the directory not the library, in your output you point explicitly to libmqjbnd.so but I think that it should be the directory containing it:
Code: |
export LD_LIBRARY_PATH="/opt/mqm/java/lib64/"
|
|
Been there done that! FAIL!
manicminer wrote: |
"apparently" the thing that is checked to find the dll is the java.library.path. You could set this using a -D option on your java call:
Code: |
-Djava.library.path=/opt/mqm/java/lib64/
|
|
You sir ... are a bloody HERO ... a giant among men!
Code: |
dis ql(SYSTEM.DEFAULT.LOCAL.QUEUE) curdepth
5 : dis ql(SYSTEM.DEFAULT.LOCAL.QUEUE) curdepth
AMQ8409: Display Queue details.
QUEUE(SYSTEM.DEFAULT.LOCAL.QUEUE) TYPE(QLOCAL)
CURDEPTH(0) |
Code: |
~> java -Djava.library.path=/opt/mqm/java/lib64/ mqhash ALICE SYSTEM.DEFAULT.LOCAL.QUEUE |
Code: |
dis ql(SYSTEM.DEFAULT.LOCAL.QUEUE) curdepth
1 : dis ql(SYSTEM.DEFAULT.LOCAL.QUEUE) curdepth
AMQ8409: Display Queue details.
QUEUE(SYSTEM.DEFAULT.LOCAL.QUEUE) TYPE(QLOCAL)
CURDEPTH(1) |
_________________ Here's an idea - don't destroy semaphores unless you're certain of what you're doing! -- Vitor |
|
Back to top |
|
 |
friedl.otto |
Posted: Tue Feb 24, 2009 3:41 am Post subject: |
|
|
Centurion
Joined: 06 Jul 2007 Posts: 116
|
To all those people who don't come to MQSeries.net net after 7 seconds of
pondering a problem, who have deliberated at length with Google the
Sage, who have befriended the Gorgon of the Info Centre, who have bled
battling the fanged beasts that roam the dungeons of BigBloo ...
... the heros on this forum are faster, stronger, cleverer and harder than
anyone in the whole of SPARTAAA!
Once again ... muchos graçias to everyone who offered help!  _________________ Here's an idea - don't destroy semaphores unless you're certain of what you're doing! -- Vitor |
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 24, 2009 3:46 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
I just said "post the solution". Though the rousing speech is obviously welcome.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|