Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MQ Trigger calls Java Pgm, but Java Pgm not able to call Queue inturn.

Status
Not open for further replies.

Gowrishankars

Programmer
Dec 10, 2003
3
DE
Hello,
We are facing a problem here using the MQ Trigger.
We are using MQ Trigger to call a shell script that in turn calls the java program.
The java program gets the message (using MQGET call) from the queue on which the Triggering was set.
The java program is not able to reference the Queue. The program stops responding (as if it is on an infinite loop) and the process hangs forever.
We tried running the shell script from the command prompt and the program is getting executed successfully.

1. Does the trigger monitor lock the trigger queue, so that we can't get messages from the queue?
2. Do we need to set any property on the queue/ Trigger monitor/Process for enabling the get-messaging from the queue.

Thanks in advance,
Gowri.
 
A1) No.
A2) Not really.

When you say "The java program is not able to reference the Queue", what exactly do you mean???

Also when you say "The program stops responding ", what do you mean??? Do you mean the java program is triggered and it doesnt get any messages but instead is hung. Or is the trigger mon not working and is hung??? If its the java program, how do you know. Does the trigger mon show it triggered the java app??? If yes, then did the java app execute. What platform is this. In any platform you should be able to verify if the java app is running. On Windows goto the task manager and verify, on unix systems use "ps".

You have to be more specific as to what the problem is and where does it happen. If the java app is hung, where is it hung, is it on an MQ Api call or some place else.

Did the java app open the queue at all??? You can verify this by looking at the ip/opprocs depending upon what you are doing.



Cheers
KK
 
Hello KK,
Here are more details:
Platform - AIX

1. Trigger monitor is working fine since triggering a Hello world java program using MQ triggering prints the output to a file and ends the program normally. Again we have called a shell script here which in turn triggers the java program.
2. Java program is hanging - specifically, it is hanging when calling the following API:
MQQueueManager qm = new MQQueueManager("qmname");

We tried setting the MQSERVER environment in the shell script that is getting triggered, but this doesn't help.

Should we use the MQEnvironment class in the Java program to solve this problem.

Thanks in advance,
Gowri.
 
Well to begin with, until the api call comes back with either a success or a failure, its hard to say whats wrong and where it is. And since you did not mention that you got an error or a success back, i am not sure what we can do.

When you say hanging, do you mean the java app stops responding. If so, how do you know that it is hung on this particular api call only??? Any printf's etc to figure that out.

Looking at your description, it looks like you are connecting to a remote system since you mentioned MQSERVER. Now this leads me to thinking that you must be having both server and client versions of MQ installed on this system or you are using a client trigger monitor. Because you dont need MQSERVER variable or any such variables to connect to a local queue manager.

In that case, yes, its good and easy to use MQEnvironment within java app. May be that your environment variables are not being propogated to the java app.

But i would strongly debug this whole thing. Because if thats the case, then the api call to connect to the qm should come back with either 2058 or 2059, shouldnt just hang.



Cheers
KK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top