ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » [SOLVED] Technical problem in Triggering (AIX)

Post new topic  Reply to topic Goto page 1, 2  Next
 [SOLVED] Technical problem in Triggering (AIX) « View previous topic :: View next topic » 
Author Message
mca
PostPosted: Tue Apr 12, 2005 9:23 am    Post subject: [SOLVED] Technical problem in Triggering (AIX) Reply with quote

Disciple

Joined: 09 Mar 2005
Posts: 196

I have an Queue Manager "QM" and LocalQueue "Q". I have an sample XML message. I put the XML message into the Q using my "runmqput" program and it works absolutely fine.

My aim here is to invoke an java application program as soon as the message is put in Q. So, i opted the triggering mechanism. This is what my program does in 3 simple steps...

1. My "runmqget" program is invoked and it takes the XML message and inturn displays XML message.
2. It calls "MessageParser" and parses the details and inturn displays the details it has parsed.
3. Invokes the Java application program and does the work it needs to using the values already parsed.

without using trigger mechanism if i type "runmqput" in cmd prompt, it finely puts message and returns back to cmd prompt. If i type "runmqget" there in cmd prompt again it displays XML message, displays Parsed values and does the application program perfectly all in one command.

But if i use trigger mechanism and specify the path of "runmqget" and issue the "runmqput" in cmd prompt it is getting triggered and displaying XML message but it stops there forever before displaying the parsed values and also doesnot do the required work and even it doesnot go back saying WAITING FOR TRIGGER MESAGE, which means it is not working.

My question here is if i run the program manually without triggering mechanism it works. But how come the program execution stopped in between if it is getting triggered. Any suggestions will be greatly appreciated. Thanks in advance.

MCA


Last edited by mca on Wed Apr 27, 2005 8:04 am; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
jefflowrey
PostPosted: Tue Apr 12, 2005 9:37 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

http://www.mqseries.net/phpBB2/viewtopic.php?t=12988
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mca
PostPosted: Tue Apr 12, 2005 12:24 pm    Post subject: Reply with quote

Disciple

Joined: 09 Mar 2005
Posts: 196

thanks jeff for ur reply. Its definately useful notes.

But i have already done the way it was specified in the notes and Trigger monitor works for me .. like path and all are correct and specified in seperate shell script and its invoking the program its supposed to, but leaving half way before parsing the values. Like its doing the work in "runmqget" but not calling the other class "MessageParser" from this one. The program is correct if executed manually, but doesnot work perfectly when triggered(only half-execution). May be some link with trigger monitor and JDom parser ? not sure ...
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
fjb_saper
PostPosted: Tue Apr 12, 2005 6:45 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Before you start the trigger monitor you must set a few environment variables. If they are not set right the java process could hang when triggered.

At the same time you need to make sure that your java app starts in the right directory and has the right classpath.

The NYNJMQ.org should have a ppt to that effect after it's next session.

Enjoy
Back to top
View user's profile Send private message Send e-mail
Nigelg
PostPosted: Wed Apr 13, 2005 2:57 am    Post subject: Reply with quote

Grand Master

Joined: 02 Aug 2004
Posts: 1046

fjb is referring to AMQ_NO_SIGWAIT_SIGTRAP and APAR IY43961, included in 5.3 CSD04. Set this env var (to any value) in the shell yoiu start the trigger monitor from. This only applies to AIX.
Back to top
View user's profile Send private message
mca
PostPosted: Wed Apr 13, 2005 8:16 am    Post subject: program statement not getting executed by trigger monitor Reply with quote

Disciple

Joined: 09 Mar 2005
Posts: 196

Actually i think it might be the problem with some MQ configurations with trigger monitor. Because i tried executing it this way and it worked:

cat >> test
/var/fmc/ExtApps/runmqput
/var/fmc/ExtApps/runmqget

$ ./test

with this execution it worked perfect and i tried giving the path '/home/fmc/test' in trigger monitor and executed. It stopped at same point where it used to. Then i inserted some print statements in my MessageParser.java program and found out where the execution is being stopped. This helped. Here is the code of init() method where the execution is being stopped.

private void init() {
print("step1");
builder = new SAXBuilder();
print("step2");
Reader reader;
print("step3");
reader = new StringReader(msg);
print("step4");
try {
print("step5");
doc = builder.build(reader);
print("step6");
}
In my output using trigger monitor it is printing step1 step2 step3 step4 step5, but step6 is not getting printed. So, my problem is with statement "doc = builder.build(reader);" So, what i have done is changed some code so that it may execute and this is the way my new code looked like:

private void init() {
print("step1");
builder = new SAXBuilder();
print("step2");
// Reader reader;
print("step3");
// reader = new StringReader(msg);
print("step4");
try {
print("step5");
byte[] xmlBytes = msg.getBytes("UTF8");
doc = builder.build(new ByteArrayInputStream(xmlBytes));
// doc = builder.build(reader);
print("step6");
}

I tried executing it with trigger monitor and again step6 did not print. So, my problem with trigger monitor is associated to this step where it freezes. Any idea why this is happening. Any changes in code will be greatly appreciated. Thanks in advance.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
vennela
PostPosted: Wed Apr 13, 2005 10:31 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

If the platform is AIX, there is a known bug that the application hangs at QManager object creation. What version of MQ are you running.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mca
PostPosted: Wed Apr 13, 2005 11:20 am    Post subject: Reply with quote

Disciple

Joined: 09 Mar 2005
Posts: 196

My platform is AIX and the version i am using is MQ 5.3 and CSD 09. I tried setting in my fmc environment like this as adviced by Nigelg

set AMQ_NO_SIGWAIT_SIGTRAP=1
export AMQ_NO_SIGWAIT_SIGTRAP

and still NO CHANGE. its stopping in the same place in the program. Also as a reminder the problem is with triggering mechanism i guess because the aplication works with all possible ways except when getting triggered(which stops half-way).
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
fjb_saper
PostPosted: Wed Apr 13, 2005 6:34 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Do a search on the site. I have published the variables in an earlier post.
The variable shown as above is to avoid have a 265 in the DLQ
You need to start the trigger monitor with an nocompile setting (post csd04?)

Enjoy
Back to top
View user's profile Send private message Send e-mail
Nigelg
PostPosted: Thu Apr 14, 2005 12:05 am    Post subject: Reply with quote

Grand Master

Joined: 02 Aug 2004
Posts: 1046

AMQ_NO_SIGWAIT_SIGTRAP is to prevent a hang when a triggered java app starts.

The nocompile option, export JAVA_COMPILER=NONE, is an alternative to loading CSD04 and setting the env var.
The problem is caused by the JIT compiler in java on AIX needing the SIGTRAP signal to work, and WMQ blocking the signal in the trigger monitor and in forked programs.

For the technically minded...
The fix and env var causes the signal to be caught using sigaction() rather than it being blocked on all threads and caught in sigwait().

The env var that fjb is thinking of, to prevent the trigger msg going to the DLQ with reason code x109, is AMQ_SIGCHLD_SIGACTION

Anyway, in this post the problem is nothing to do with the env var, because the app starts OK. Probably just another app bug.
Back to top
View user's profile Send private message
mca
PostPosted: Fri Apr 15, 2005 7:11 am    Post subject: Reply with quote

Disciple

Joined: 09 Mar 2005
Posts: 196

These are the header files i am using in my MessageParser.java program. Will i need to add anymore for this application to run using triggering ?

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;

and this is the part of code where my application is not being processed. May be it helps to trace out.

private void init() {
builder = new SAXBuilder();
Reader reader;
reader = new StringReader(msg);
try {
doc = builder.build(reader); <------THIS PART IS NOT GETTING EXECUTED WHILE TRIGGERING
} catch (JDOMException e2) {e2.printStackTrace();}
catch (IOException e2) {e2.printStackTrace();}
}

Thanks
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
RogerLacroix
PostPosted: Fri Apr 15, 2005 8:52 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Hi,

Aside from those suggested environment variables, are you sure your CLASSPATH is correct??

I have seen people relying on a .profile being called for triggering but it wasn't. The MQ Process definition should invoke a shell script. In the shell script you should put ALL environment variables, i.e. CLASSPATH, LIBPATH, etc. and then invoke your java application.

Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
mca
PostPosted: Fri Apr 15, 2005 9:36 am    Post subject: Reply with quote

Disciple

Joined: 09 Mar 2005
Posts: 196

I did the way you suggested Roger. Like invoked an script file which contains all ClassPaths and LibPaths and the name of Java Apllication program mentioned in it. My "runmqget" script file looks like this...

#!/bin/ksh

LIB_DIR=/var/fmc/ExtApps

java -Djava.library.path=/usr/lpp/mqm/java/lib -cp $LIB_DIR/extlib:$LIB_DIR/extlib/com.ibm.mq.jar:$LIB_DIR/extlib/com.ibm.mqbind.jar:$LIB_DIR/extlib/com.ibm.mqjms.jar:$LIB_DIR/extlib/connector.jar:$LIB_DIR/extlib/jms.jar:$LIB_DIR/extlib/jdom.jar:$LIB_DIR/extlib/mail.jar:$LIB_DIR/extlib/jndi.jar:$LIB_DIR/extlib/ldap.jar:$LIB_DIR/extlib/jta.jar:$LIB_DIR/extlib/activation.jar MQGet

Plz correct me if any files missing that may be required for invoking this file by triggering mechanism. If CP's are not specified, this application must not work even from cmd prompt. But in my case it does.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
RogerLacroix
PostPosted: Fri Apr 15, 2005 2:09 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Hi,

Those MQ library directories ( /usr/lpp/mqm/java/lib ) look weird. What version of WMQ are you using??

Please read the WMQ Using Java manual (chapter 2) for the correct directory paths for MQ Java libraries.

Also, why did you copy all of the MQ jar files to /var/fmc/ExtApps/extlib - I mean it is odd. Why didn't you use the MQ jar files that are in /opt/mqm/java/lib ??



Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Fri Apr 15, 2005 7:35 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

What do you remember about XML and Java ?
Quote:
$LIB_DIR/extlib:$LIB_DIR/extlib/com.ibm.mq.jar:
$LIB_DIR/extlib/com.ibm.mqbind.jar:
$LIB_DIR/extlib/com.ibm.mqjms.jar:
$LIB_DIR/extlib/connector.jar:
$LIB_DIR/extlib/jms.jar:
$LIB_DIR/extlib/jdom.jar:
$LIB_DIR/extlib/mail.jar:
$LIB_DIR/extlib/jndi.jar:
$LIB_DIR/extlib/ldap.jar:
$LIB_DIR/extlib/jta.jar:
$LIB_DIR/extlib/activation.jar


Looks like you have the Interface in your classpath (jdom.jar) like xml-apis.jar
but where is the implementation ?? Typical xerces-impl.jar ?

That would explain your code blowing up where it does.

Enjoy
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » General IBM MQ Support » [SOLVED] Technical problem in Triggering (AIX)
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.