Author |
Message
|
jed |
Posted: Mon Oct 04, 2004 8:26 pm Post subject: H E L P !!!!! Java program that will be triggered... |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
I've setup a queue that will trigger a script that contains a java program.
This java program will only just get a message from a queue.
* Why does the segment below don't work?
I'm focusing on the mqQmgr = new MQQueueManager(sQmgr);. It doesn't work when I try the trigger part.
But, if I run the java program on the $ prompt it works.
public static String getMQ(String sQmgr, String sQueue)
{
MQQueueManager mqQmgr;
MQQueue mqQueue;
MQMessage mqMessage;
boolean bNoRetVal = false;
String sMessage = new String();
try
{
mqQmgr = new MQQueueManager(sQmgr);
mqMessage = new MQMessage();
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING;
mqQueue = mqQmgr.accessQueue(sQueue, openOptions); MQGetMessageOptions mqGetOptions = new MQGetMessageOptions();
mqGetOptions.options = MQC.MQGMO_NONE | MQC.MQPMO_FAIL_IF_QUIESCING;
mqQueue.get(mqMessage,mqGetOptions); sMessage = mqMessage.readLine(); mqQmgr.commit();
mqQueue.close();
mqQmgr.disconnect();
}
catch (IOException ioE)
{
writeLog("IO Error : " + ioE);
System.exit(0);
}
catch (MQException mqEx)
{
if (mqEx.completionCode == 2 || mqEx.completionCode == 1)
{
if (mqEx.reasonCode == 2033)
{
bNoRetVal = true;
}
else
{
writeLog("MQ Error : " + mqEx);
System.exit(0);
}
}
}
if (bNoRetVal)
{
return "";
}
else
{
return sMessage;
}
} _________________ Jed |
|
Back to top |
|
 |
siliconfish |
Posted: Mon Oct 04, 2004 8:36 pm Post subject: |
|
|
 Master
Joined: 12 Aug 2002 Posts: 203 Location: USA
|
Quote: |
Why does the segment below don't work?
I'm focusing on the mqQmgr = new MQQueueManager(sQmgr);. It doesn't work when I try the trigger part.
But, if I run the java program on the $ prompt it works. |
What do u mean by "don't work"? What is the error? [/code] _________________ siliconfish |
|
Back to top |
|
 |
jed |
Posted: Mon Oct 04, 2004 8:40 pm Post subject: |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
it doesn't work meaning......
when i run the java program on the $ prompt.... it gets (MQGET) the message from the queue....
but, when it is run via the queue trigger/process... it doesn't work.
no error... it just hangs up on the new MQQueueManager(); _________________ Jed |
|
Back to top |
|
 |
siliconfish |
Posted: Mon Oct 04, 2004 8:48 pm Post subject: |
|
|
 Master
Joined: 12 Aug 2002 Posts: 203 Location: USA
|
Why do you think its hanging at that line?
Can u redirect the runmqtrm output to a file or get it from the command line and post it? _________________ siliconfish |
|
Back to top |
|
 |
vennela |
Posted: Mon Oct 04, 2004 8:50 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
What CSD are you at
There is an APAR that is fixed in CSD04 that I bumped into last week
Quote: |
IY43961 - A triggered Java application hung when instantiating a
new queue manager object.
|
|
|
Back to top |
|
 |
jed |
Posted: Mon Oct 04, 2004 8:59 pm Post subject: |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
for ms. vennela here is the result of my mqrc run....
/mrv/home/apmrv/bin>mqver
Name: WebSphere MQ
Version: 530.5 CSD05
CMVC level: p530-05-L030926
BuildType: IKAP - (Production)
/mrv/home/apmrv/bin> _________________ Jed |
|
Back to top |
|
 |
jed |
Posted: Mon Oct 04, 2004 9:03 pm Post subject: |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
this is for mr. siliconfish....
i've modified my program to display (System.out.println()) as shown below.....
public static String getMQ(String sQmgr, String sQueue)
{
MQQueueManager mqQmgr;
MQQueue mqQueue;
MQMessage mqMessage;
boolean bNoRetVal = false;
String sMessage = new String();
System.out.println("getMQ");
try
{
MQEnvironment.hostname = null;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);
System.out.println("new MQQueueManager() : " + sQmgr);
mqQmgr = new MQQueueManager(sQmgr);
System.out.println("new MQMessage()");
mqMessage = new MQMessage();
System.out.println("openOptions");
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING;
System.out.println("accessQueue");
mqQueue = mqQmgr.accessQueue(sQueue, openOptions); // Accessing
the queue
MQGetMessageOptions mqGetOptions = new MQGetMessageOptions(); // Get options
mqGetOptions.options = MQC.MQGMO_NONE | MQC.MQPMO_FAIL_IF_QUIESCING;
System.out.println("mq.Queue.get");
mqQueue.get(mqMessage,mqGetOptions); // G
et the message
sMessage = mqMessage.readLine();
// Read the message
System.out.println("mqQmgr.commit");
mqQmgr.commit();
mqQueue.close();
mqQmgr.disconnect();
}
catch (IOException ioE)
{
System.out.println("IO Error : " + ioE);
System.exit(0);
}
catch (MQException mqEx)
{
if (mqEx.completionCode == 2 || mqEx.completionCode == 1)
{
if (mqEx.reasonCode == 2033)
{
bNoRetVal = true;
}
else
{
System.out.println("MQ Error : " + mqEx);
System.exit(0);
}
}
}
if (bNoRetVal)
{
return "";
}
else
{
return sMessage;
}
}
and........ here's the successful run when i execute the program on $prompt...
/mrv/home/apmrv/bin>BILLPSR.SH
executing BillPsr
Program Starts!
Args[0] : bill
vProcess
bProcessConfigFile
getMQ
new MQQueueManager() : QM.R501780
new MQMessage()
openOptions
accessQueue
mq.Queue.get
mqQmgr.commit
After getMQ!
Program Ends!
BillPsr has just finished
by the way, i use a script to call the java program... script is below....
/mrv/home/apmrv/bin>cat BILLPSR.SH
#!/usr/bin/ksh
cd /mrv/home/apmrv/bin
echo "executing BillPsr"
export AAA=`date`
java BillPsr bill $AAA
echo "BillPsr has just finished"
and... here is the erroneous output on the mq trigger of the java program...
/mrv/home/apmrv/bin>trigq
5724-B41 (C) Copyright IBM Corp. 1994, 2002. ALL RIGHTS RESERVED.
WebSphere MQ trigger monitor started.
__________________________________________________
Waiting for a trigger message
BILLPSR.SH 'TMC 2QM.R501780.LQ BILLPSR BILLPSR.SH QM.R501780 '
executing BillPsr
Program Starts!
Args[0] : bill
vProcess
bProcessConfigFile
getMQ
new MQQueueManager() : QM.R501780 _________________ Jed |
|
Back to top |
|
 |
vennela |
Posted: Mon Oct 04, 2004 9:20 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Try this and see
I found this in the IBM web site on a search for IY43961
Quote: |
This APAR introduces a new environment variable named
AMQ_NO_SIGWAIT_SIGTRAP to WebSphere MQ V5.3, which must be used
to make the change effective. Set this environment variable to
a value of 1 (and ensure it is exported) in the shell from which
you start your Java program.
|
Export the variable and see if it helps |
|
Back to top |
|
 |
jed |
Posted: Mon Oct 04, 2004 9:34 pm Post subject: |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
but, i already have fix-pack CSD 05....
still doesn't work?
so, i just do.... export AMQ_NO_SIGWAIT_SIGTRAP=1? _________________ Jed |
|
Back to top |
|
 |
vennela |
Posted: Mon Oct 04, 2004 9:37 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Doesn't hurt to try.
Quote: |
export AMQ_NO_SIGWAIT_SIGTRAP=1 |
Yes, in the shell script that you are triggering. |
|
Back to top |
|
 |
jed |
Posted: Mon Oct 04, 2004 9:55 pm Post subject: |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
hhhmm..... i don't know if it worked...
but, i got this output from my trigger monitor apps.
/mrv/home/apmrv/bin>runmqtrm -m QM.R501780 -q SYSTEM.DEFAULT.INITIATION.QUEUE
5724-B41 (C) Copyright IBM Corp. 1994, 2002. ALL RIGHTS RESERVED.
WebSphere MQ trigger monitor started.
__________________________________________________
Waiting for a trigger message
BILLPSR.SH 'TMC 2QM.R501780.LQ BILLPSR BILLPSR.SH QM.R501780 '
executing BillPsr
Program Starts!
Args[0] : bill
vProcess
bProcessConfigFile
getMQ
new MQQueueManager() : QM.R501780
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't find library mqjbnd05 (libmqjbnd05.a or .so) in java.library.path
java.library.path=/usr/java130/jre/bin:/usr/java130/jre/bin/classic::/usr/lib
at java.lang.ClassLoader.loadLibrary(ClassLoader.java(Compiled Code))
at java.lang.Runtime.loadLibrary0(Runtime.java:780)
at java.lang.System.loadLibrary(System.java:865)
at com.ibm.mq.MQSESSION.loadLib(MQSESSION.java:855)
at com.ibm.mq.server.MQSESSION$1.run(MQSESSION.java:221)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.mq.server.MQSESSION.<clinit>(MQSESSION.java:215)
BillPsr has just finished
Error starting triggered application. _________________ Jed |
|
Back to top |
|
 |
jed |
Posted: Mon Oct 04, 2004 9:59 pm Post subject: |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
this is my classpath and libpath.....
/mrv/home/apmrv/bin>echo $CLASSPATH
/usr/mqm/java/lib/com.ibm.mq.jar:/usr/mqm/java/lib/jta.jar:/usr/mqm/java/lib/connector.jar:/usr/mqm/samp/java/base:.
/mrv/home/apmrv/bin>echo $LIBPATH
/usr/mqm/java/lib
did i miss anything? _________________ Jed |
|
Back to top |
|
 |
vennela |
Posted: Mon Oct 04, 2004 10:04 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
What OS are you running on.
Depending on the OS you need to set the env variable
AIX LIBPATH
HP-UX SHLIB_PATH
Solaris & Linux LD_LIBRARY_PATH
Setting that would get ri of the error that you mentioned.
Looks like you are one step closer for me.
Make sure you have them visible inside the script.
If that doesn't work then I might be misleading you to something then. |
|
Back to top |
|
 |
jed |
Posted: Mon Oct 04, 2004 10:10 pm Post subject: |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
i've already set the LIBPATH... i'm using AIX 5.1
its set as.... export LIBPATH=/usr/mqm/java/lib as per IBM docs. _________________ Jed |
|
Back to top |
|
 |
jed |
Posted: Mon Oct 04, 2004 10:14 pm Post subject: |
|
|
 Centurion
Joined: 08 Jan 2004 Posts: 118 Location: MI, USA
|
IT WORKED!!!!!!
I just modified the script that i was using to run the java program...
Here's the script..... Doggone it! I've already defined the CLASSPATH and LIBPATH on the .profile.... How come it did not work? It only worked when i added those into the script....
/mrv/home/apmrv/bin>cat BILLPSR.SH
#!/usr/bin/ksh
cd /mrv/home/apmrv/bin
echo "executing BillPsr"
export CLASSPATH=/usr/mqm/java/lib/com.ibm.mq.jar:/usr/mqm/java/lib/jta.jar:/usr/mqm/java/lib/connector.jar:/usr/mqm/samp/java/base:/mrv/home/apmrv/EB2MINT/LibDir/eb2mint2.jar:.
export LIBPATH=/usr/mqm/java/lib
export AAA=`date`
java BillPsr bill $AAA
echo "BillPsr has just finished" _________________ Jed |
|
Back to top |
|
 |
|