Author |
Message
|
MikeOliverAZ |
Posted: Sun Nov 17, 2013 7:01 pm Post subject: Working WMB 8.0 Application with two MQ Input nodes throws |
|
|
 Apprentice
Joined: 10 Jul 2013 Posts: 47
|
We have a working WMB 8.0 Application with two MQ Input nodes both using XMLNSC. When we tried to increase the number of instances on both nodes, we start getting NPE in a JCN that both MQ Input nodes feed.
This only happens after a while, i.e 5-10 transactions, so it is very difficult to catch with the debugger. The Java class has a JDBC configured service, and uses a singleton class FYI.
I am using the log4jNode and will keep adding loggers until I get it zeroed in, debugger just takes too long and jumps around too much.
MO |
|
Back to top |
|
 |
smdavies99 |
Posted: Sun Nov 17, 2013 10:45 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Whilst I am no java expert, may I suggest that adding more Log4J nodes is only going to make the problem harder to solve.
I'd probably propagate out to an MQOutputNode from various places in the flow. It MAY reduce the effect on the flow that the Log4J node would impose.
I am sure some more expert opinions will be along shortly. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Esa |
Posted: Mon Nov 18, 2013 1:32 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
What does the stack trace for the NPE say? |
|
Back to top |
|
 |
kimbert |
Posted: Mon Nov 18, 2013 1:46 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
MikeOliverAZ |
Posted: Mon Nov 18, 2013 7:57 pm Post subject: NPE not something special |
|
|
 Apprentice
Joined: 10 Jul 2013 Posts: 47
|
The NPE is
Code: |
java.lang.NullPointerException
at com.smart.soa.handlers.RouteToReplyQ.execute(RouteToReplyQ.java:77)
at com.smart.soa.doc.DynamicOrchestrationController.doAfter(DynamicOrchestrationController.java:460)
at com.smart.soa.doc.DynamicOrchestrationController.evaluate(DynamicOrchestrationController.java:243)
at com.ibm.broker.javacompute.MbRuntimeJavaComputeNode.evaluate(MbRuntimeJavaComputeNode.java:265)
at com.ibm.broker.plugin.MbNode.evaluate(MbNode.java:1480)
|
The place in the code is also nothing special.
Code: |
MbXPath atomicServiceQXP = new MbXPath("/doc:UDTO/doc:MessageVariables/doc:AtomicServiceQMgr");
atomicServiceQXP.addNamespacePrefix("doc", "http://smart.com.ph/doc/");
atomicServiceQXP.setDefaultNamespace("http://smart.com.ph/doc/");
nodeset1 = (List)outAssembly.getMessage().evaluateXPath(atomicServiceQXP);
if (nodeset1.size() > 0){
atomicServiceQMgr = (MbElement) nodeset1.get(0);
}
|
The atomicServiceQMgr element is never null when the MQ Input instance is 1 from the flow pool , but roughly half are null (with 2 instances) |
|
Back to top |
|
 |
Esa |
Posted: Mon Nov 18, 2013 11:45 pm Post subject: Re: NPE not something special |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
I guess it's this line that has number 77:
Code: |
nodeset1 = (List)outAssembly.getMessage().evaluateXPath(atomicServiceQXP);
|
Because the only element that can be null in your code snippet is outAssembly.getMessage() |
|
Back to top |
|
 |
MikeOliverAZ |
Posted: Tue Nov 19, 2013 3:28 am Post subject: more info |
|
|
 Apprentice
Joined: 10 Jul 2013 Posts: 47
|
First of all the NPE on line 77 is a line just after the code block. Sorry but it is trying to get the value from that element and nodeset == 0. That same code works fine on thousands of records when the input node is a single instance and fails with that NPE about 50% of the time with two instances...
Here is the flow diagram...
Note the two MQ Input nodes on the left. The top one is for new messages and the bottom one is for re-entry from AtomicServices. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 19, 2013 3:44 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Wrap your code in a synchronized block.
Or simply check that nodeset1 is not null before trying to access it's size. |
|
Back to top |
|
 |
Esa |
Posted: Tue Nov 19, 2013 5:01 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
mqjeff wrote: |
Wrap your code in a synchronized block.
Or simply check that nodeset1 is not null before trying to access it's size. |
Wrapping only the quoted lines in a synchronized block wouldn't help, because the cause is somewhere else.
Wrapping the whole contents of evaluate() certainly would help, but that would in effect mean running one instance at the time.
Something in the code may have been incorrectly declared static. nodeset1? Some MbMessage or MbElement?
What is the purpose of the singleton class? Is it programmed correctly?
If the field pointed to by the XPath is not present in the message, you should get an empty List, never a null. I think.
Are you sure that you are running the correct version of the java code? Recompile and redeploy, test and check if the line number is still 77. |
|
Back to top |
|
 |
MikeOliverAZ |
Posted: Tue Nov 19, 2013 6:23 pm Post subject: |
|
|
 Apprentice
Joined: 10 Jul 2013 Posts: 47
|
The singleton is unrelated, to the NPE it is used in another class and works well, its a connection to memcached and I used a singleton because I want to reuse the connection to the memcached client.
As I said, the NPE only occurs when the MQ Input node is set with 2 instances instead of 1 from the flow pool.
For clarity I rewrote the code where the NPE was being thrown...
Code: |
MbXPath atomicServiceQXP = new MbXPath("/doc:UDTO/doc:MessageVariables/doc:AtomicServiceQ");
atomicServiceQXP.addNamespacePrefix("doc", "http://smart.com.ph/doc/");
atomicServiceQXP.setDefaultNamespace("http://smart.com.ph/doc/");
nodeset = (List)outAssembly.getMessage().evaluateXPath(atomicServiceQXP);
if (!(nodeset == null) && nodeset.size() > 0){
atomicServiceQ = (MbElement) nodeset.get(0);
// we can set this outright since it is created upon creation of udto
atomicServiceQ.setValue(getRuleDefinition().getAtomicQueueName());
}
|
The line 77 reference has changed as it was the setValue which I had outside the if test.
Since it runs fine in single instance, despite the logic / style error the problem still exists and while I have no NPE now, the messages coming in via the DOC.Return queue are corrupt about 50% of the time when 2 instances are configured. |
|
Back to top |
|
 |
Esa |
Posted: Tue Nov 19, 2013 10:53 pm Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
MikeOliverAZ wrote: |
The line 77 reference has changed as it was the setValue which I had outside the if test. |
For clarity, please add line numbers manually in your code excerpt.
Run the test again and post the new stack trace.
As the line referenced by the stack trace may have changed as well.
But if I understood correctly you must mean that the exception happens on this line:
Code: |
atomicServiceQ.setValue(getRuleDefinition().getAtomicQueueName()); |
which means that it must be either getRuleDefinition() or getAtomicQueueName() that return null? |
|
Back to top |
|
 |
|