Problem running native methods

Jun 18, 2008 at 8:30 PM
Edited Jun 18, 2008 at 8:38 PM
Hi,
This is going to be pretty hard to explain but I figured I'd try anyway...

Basically, I'm running some code that implements a listener (this is in java), and upon triggering this listener, I want the program to automatically Open an exisiting queue in MSMQ, and send a given message to that queue.

I've commented out main in the TestClient.java MsmqJava code, and basically I run the Open and Send methods (changed slightly) when this listener is triggered to acheive what I want. 

Right now, when the program runs and the listener is triggered, the code gets to the Open method in the MsmqJava code, but when it reaches the "Msmq = new Queue(name);" line (where it actually sets the instance of Queue to the one given to open it), it seems to stop.  The program itself does not stop running, and there is no error given, and when the next listener is triggered it reapeats this process, but it seems to be having trouble actually accessing the Queue.java code (since nothing after this code in the MSMQ side is hit.  No message is sent, the queue doesn't even seem to actually open).  Since I am using a separate application to link to this one, I have several different directories and I have a feeling that this is why it's not working.  Perhaps the Queue.java, etc., files are not being accessed properly or perhaps the JNIMSMQ.dll file is not being found.  But I figured this would trigger its own error, and everything compiles and runs fine (up until this problem). 

  I know that I can't exactly describe the situation better than that but I was hoping maybe something would stand out and you'd be able to help.

Thanks very much, I appreciate it.
Jun 18, 2008 at 9:08 PM
Edited Jun 23, 2008 at 4:08 PM
I figured out that it stops proceeding right when it trys to load the JNIMSMQ.dll file in the static initializer block in Queue.java

It must not successfully load the dll file, but I do not receive any error or warning or anything.  I've also tried placing the .dll file in all different locations, so I'm not sure why it isn't working.

Edit:

At first I could not get it to load the .dll file, at least it would not hit any code after this statement.  However, using System.load and the absolute path, I was able to hit code that was after the load .dll statement.  However, it would not go past the nativeInit() code even when running past the System.load( ) call. 

It doesn't seem to be running these native calls properly, and I believe this is the source of the problem.. any suggestions?  Am I not properly including any of the files (I only have Queue.java, Message.java, MessageQueueException.java, and JNIMSMQ.dll in the project)?  I'm not sure where to put the C files or how to reference them.

Since I changed the code do I have to create a new .dll file to reference the changed class files?  And if so, how can I do that?  I've tried making a new .dll library based off of tutorials I've seen online but none of the commands seem to be working (I'm working in windows).

Thanks.