6
votes

I'm trying to send a message to a java server over a Websphere MQ which uses JMS as the transport protocol. I can happily drop messages on the MQ using the IBM supplied libraries, but the server rejects them. I'm assuming (hopefully correctly) that this is because I'm missing various JMS specific headers/properties on the MQ message.

I have ensured the payloads for the messages are the same by inspecting the queue (they are both map messages if that helps), but don't want to fully implement the JMS Websphere MQ protocol just to get this to work.

I'm wondering if anyone has managed to get this to work, and if so what's the minimum amount of information you need to specify in the JMS header? Are there any alternatives to doing this directly on the MQ (I've seen some about using java interop, but this is something I think would be overkill).

Any help would be greatly appreciated!

4
Could you post the error message you get, also check the MQ logs for details. Do you have a reason and error code?Karl
The error message just says that the message is not a MapMessage.jonnii

4 Answers

2
votes

Can you paste the Java code you are using to read the message. Is that code assuming that the message is a "MapMessage". Normally something put into a Queue from a non-java client will appear as either a TextMessage or a BytesMessage.

The WebsphereMQ JMS api is normally fine with reading those messages without the JMS headers as long as you read as a TextMessage / BytesMessage as put.

In my server code, my content is normally put to the queue as bytes, and so appears as a BytesMessage, but just in case i get a message that was manually put on the queue, i catch the classcastexception, and test to see if it is in fact a TextMessage.

1
votes

Are you trying to use MQI to send JMS messages? Take a look at the XMS libraries from IBM. They will provide everything that you need. The libraries provide a .NET implementation of JMS that works with WebsphereMQ. I have used these libs many times over the past year, talking between java and .net systems, and have been very happy with the functionality.

XMS .NET Library Download

1
votes

WebSphere MQ doesn't have very clear error messages. The things I suggest to check when something went wrong are:

  1. Exception details and their recursive causes.
  2. MQ error logs.
  3. Event logs sourced by MQ.
  4. .FDC files.
0
votes

I think I had the same problem and I couldn't get XMS to work. In case it's still a problem to you, this might help

Regards Kristoffer