Author |
Message
|
golam1983 |
Posted: Sun Jan 24, 2010 3:02 pm Post subject: MQ7 PCF java Agent initiation failing |
|
|
 Apprentice
Joined: 27 Jun 2008 Posts: 35
|
Hi,
I am trying to write java program for monitoring of our mq infrastructure using PCF. I am using MQ v7.0.0.1 on a Windows XP system. Here is the error I am getting when Initializing the PCFAgent -
Code: |
java.lang.NullPointerException
at com.ibm.mq.MQQueue.get(MQQueue.java:487)
at com.ibm.mq.pcf.PCFAgent.getBasicQmgrInfo(PCFAgent.java:393)
at com.ibm.mq.pcf.PCFAgent.open(PCFAgent.java:355)
at com.ibm.mq.pcf.PCFAgent.open(PCFAgent.java:309)
at com.ibm.mq.pcf.PCFAgent.connect(PCFAgent.java:207)
at com.ibm.mq.pcf.PCFAgent.<init>(PCFAgent.java:159)
at com.ge.mq.monitoring.InquireQueue.main(InquireQueue.java:35) |
Seems like I am missing some basic step. The code snipet I am using -
Code: |
MQEnvironment.hostname = "localhost";
MQEnvironment.port = 1414;
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.userID = "mqsiuid";
MQEnvironment.password = "mqsipw";
try{
MQQueueManager qmgr = new MQQueueManager(queueManager);
PCFAgent agent = new PCFAgent(qmgr);
qmgr.close();
}catch(Exception e){
e.printStackTrace();
} |
Following line in the code is raising the above error
Code: |
PCFAgent agent = new PCFAgent(qmgr); |
Any insight will be a great help |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Jan 24, 2010 8:50 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Look into the documentation for support pack MS0B. Did you open the connection to the qmgr before the pcf agent instantiation?...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
golam1983 |
Posted: Mon Jan 25, 2010 11:58 am Post subject: |
|
|
 Apprentice
Joined: 27 Jun 2008 Posts: 35
|
Yes, I am following the MSOB support pack and "MQProgrammable Command Formats and Administration Interface" redbook for programming. I have added few lines of code to check the Queue manager connection is fine. Here is the test prototype
Code: |
public static void main(String args[])
{
MQEnvironment.hostname = "localhost";
MQEnvironment.port = 1414;
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
try{
MQQueueManager qmgr = new MQQueueManager("QM_MQSI60");
System.out.println(queueManager+": Queue Manager Connected!");
MQQueue queueTest = qmgr.accessQueue("TEST.QUEUE",MQC.MQOO_INQUIRE);
System.out.println("TEST.QUEUE depth: " + queueTest.getCurrentDepth());
System.out.println(queueManager+": Initializing PCF Agent!");
PCFMessageAgent agent = new PCFMessageAgent(qmgr);
System.out.println(queueManager+": PCF Agent Initiated!");
qmgr.close();
}catch(Exception e){
e.printStackTrace();
}
} |
Return on my console -
Code: |
QM_MQSI60: Queue Manager Connected!
TEST.QUEUE depth: 4
QM_MQSI60: Initializing PCF Agent!
java.lang.NullPointerException
at com.ibm.mq.MQQueue.get(MQQueue.java:487)
at com.ibm.mq.pcf.PCFAgent.getBasicQmgrInfo(PCFAgent.java:393)
at com.ibm.mq.pcf.PCFAgent.open(PCFAgent.java:355)
at com.ibm.mq.pcf.PCFAgent.open(PCFAgent.java:309)
at com.ibm.mq.pcf.PCFAgent.connect(PCFAgent.java:207)
at com.ibm.mq.pcf.PCFAgent.<init>(PCFAgent.java:159)
at com.ibm.mq.pcf.PCFMessageAgent.<init>(PCFMessageAgent.java:130)
at com.ge.mq.monitoring.InquireQueue.main(InquireQueue.java:40) |
It seems like the Agent is trying to read a queue but its failing. I have checked the SYSTEM.ADMIN.COMMAND.QUEUE queue is accessible and command server is running on this queue. Not sure what else I am missing....  |
|
Back to top |
|
 |
mvic |
Posted: Mon Jan 25, 2010 12:09 pm Post subject: Re: MQ7 PCF java Agent initiation failing |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
golam1983 wrote: |
Code: |
java.lang.NullPointerException
at com.ibm.mq.MQQueue.get(MQQueue.java:487) |
|
Null pointer exceptions are not "normal" behaviour. Looks like a good reason to call IBM for support.
First, though, to save potentially wasted time, maybe check this problem is still there in the latest fix pack.
7.0.0.0
7.0.0.1 <- your code
7.0.0.2
7.0.1.0
7.0.1.1 <- current code, many defects fixed. |
|
Back to top |
|
 |
golam1983 |
Posted: Mon Jan 25, 2010 12:34 pm Post subject: |
|
|
 Apprentice
Joined: 27 Jun 2008 Posts: 35
|
I had anticipated that the fixpack may work so I had upgraded it to Version: 7.0.1.1
This did not help. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jan 25, 2010 12:59 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Obviously in order to instantiate the qmgr you have the connection parameters.
What happens if you use the other method of instantiation of the PCFAgent, passing the connection parameters...?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
golam1983 |
Posted: Mon Jan 25, 2010 1:04 pm Post subject: |
|
|
 Apprentice
Joined: 27 Jun 2008 Posts: 35
|
Code: |
PCFMessageAgent agent = new PCFMessageAgent("localhost",1414,"SYSTEM.DEF.SVRCONN"); |
Tried this. Its raising the same exception. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jan 25, 2010 1:09 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
golam1983 wrote: |
Code: |
PCFMessageAgent agent = new PCFMessageAgent("localhost",1414,"SYSTEM.DEF.SVRCONN"); |
Tried this. Its raising the same exception. |
PMR time... _________________ MQ & Broker admin |
|
Back to top |
|
 |
golam1983 |
Posted: Mon Jan 25, 2010 2:03 pm Post subject: |
|
|
 Apprentice
Joined: 27 Jun 2008 Posts: 35
|
Thanks a lot you all. Will raise a PMR. I will keep posted here.... |
|
Back to top |
|
 |
RogerLacroix |
Posted: Mon Jan 25, 2010 4:00 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
I would send an email to the author of the SupportPac. His details are at the bottom of the SupportPac's readme.txt file.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jan 26, 2010 5:02 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
MS0B is integrated into the product at 7.0.1, and should not need to be downloaded and installed separately.
I suppose this could even be part of the issue, that you're using jar files that are not compatible with v7 per se (although they really should be). |
|
Back to top |
|
 |
golam1983 |
Posted: Tue Jan 26, 2010 8:10 am Post subject: |
|
|
 Apprentice
Joined: 27 Jun 2008 Posts: 35
|
I tried to run the program from command prompt and its worked
Earlier I was running from message broker toolkit. May be the issue was with my Environment.
Thanks to all for prompt help |
|
Back to top |
|
 |
|