I am new to using MQ, but need to do the seemingly simplest task. I need a Java client program to make a MQ connection and send a string over that connection to a server.
Here is what I know.
- I have installed the MQ Client v5.3 on Windows XP. - I have received a .tab file from the server group. - I have configured the environment properly, enabling me to use amqsputc to successfully send a message to the server.
Now comes the rub. I have been trying to use the sample MSender.java to write that same message from a Java program, but can't get to first base. If I try the following:
qMgr = new MQQueueManager( qManagerName );
I get the following error:
java.lang.UnsatisfiedLinkError: no mqjbnd05 in java.library.path
The file mqjbnd05 doesn't come with the client distribution, it comes with the full distribution. So I tried the following:
java.util.Hashtable props = new java.util.Hashtable(); props.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT); qMgr = new MQQueueManager( qManagerName, props );
Now it doesn't look for the server libraries, but I get a different error:
Hi, Happy to help but have to ask the obvious questions first.. 2059 normally means that the queue manager is not available.. can I assume that you have a) Created the queue manager using the crtmqm command (or whatever the command is these days) and b) started the queue manager (strmqm).
There also needs to be an mq listener running which I think was the runmqlsr -m <Qmgr> -p <port number> -t tcp (Im assuming your using TCP) command.
Check these things and if your still having probs write back.
Wait up... ignore last post (just read your post properly).. Have you set the following MQEnvironment properties correctly before trying the MQQueueManager call....
MQEnvironment.hostname = "my.mqsvr.com"; // host to connect to MQEnvironment.port = 1414; // port to connect to. // If I don't set this, // it defaults to 1414 // (the default WebSphere MQ port) MQEnvironment.channel = "channel.name"; // the CASE-SENSITIVE // name of the // SVR CONN channel on // the queue manager MQQueueManager qMgr = new MQQueueManager("MYQMGR");
Joined: Jun 16, 2006
Also if you notice in the applet code below the properties have to be stored in the MQEnvironment object. In fact the code below should provide you with all you need to connect to the server. Good luck