Java Native Interface library for MSMQ – opensource on CodePlex

More CodePlex stuff.

I have posted MsmqJava, an open source MSMQ Library for Java, on CodePlex.

Find it at .

This thing allows any Java application running on Windows to connect to MSMQ, to enqueue and dequeue items, via a Java Native Interface.   It's a nifty technology enabling interop between .NET apps and Java apps via MSMQ. 

This is a first release, very basic functionality.  Check it out.  And contribute if you can!

If you have questions on usage, check the CodePlex forums.


Comments (11)

  1. Kris says:

    I like it. Wondering why you did not make use of Enums. It is hightime Java folks move to 1.5 version.

  2. cheeso says:

    Yes, well,

    this was written a couple years back.  I finally just got round to posting the project as a codeplex thing.  So it maybe needs a refresh for Java5 optimization.  But we’ll let someone post that request as a workitem, huh?

  3. Java apps running on Windows can connect to MSMQ via JNI.

  4. SimonH says:

    Hi Thanks for the effort.

    I am getting a buffer overflow (I think) when receiving larger messages. E.g. I have 265 byte message on an WinXP Pro queue, and when I say receive on the test client I get a:

    Receive Failure hr=unknown hr (-1072824294)


    Any thoughts?

  5. cheeso says:

    Sorry, no insight into that problem…. 265 bytes does not seem like an overly large message to receive?  

  6. Mark says:

    Was there ever any resolution to this?  I’m hitting the same issue.  I can write to the queues just fine, but reading gives me the same error as Simon.

  7. markbmorgan says:

    Clarification of the problem:  I get the same failure, even with the test client doing the reading and writing.  I can write large messages (on the order of several K), but attempting to readeven the default 66 byte record from the client blows out.

  8. markbmorgan says:

    OK, for anyone who might happen to come along and try to use this code, and fail out when reading:

    The read issue is in Queue.receiveEx – the size of 128 passed to the nativeReceive is totally inadequate.  Bump this up (I bumped it to 32k for my purposes), and things will start working OK.

  9. cheeso says:

    This code has been updated, and the 128-byte limit has been removed. You should get v1.2 of MsmqJava to get the fix.

  10. Abagesh says:

    When I try to  use the code to receive message, I get the following error

    hr = unkown and hr= < -1072824294 >

    How can I handle the  -1072824294

    0xc00e001a is:

    The buffer supplied to MQReceiveMessage for message property retrieva

    l is

    too sm

    all. The message was not removed from the queue, but the part of the message


    perty that was in the buffer was copied.

    -1072824294 (0xc00e001a) MQ_ERROR_BUFFER_OVERFLOW

    Which means that the buffer pointed by PROPID_M_BODY, with length specified

    at PROPID_M_BODY_SIZE is too small. But I cant  find PROPID_M_BODY in the code. Where do I handle this ?

Skip to main content