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 » WebSphere Message Broker (ACE) Support » Working WMB 8.0 Application with two MQ Input nodes throws

Post new topic  Reply to topic
 Working WMB 8.0 Application with two MQ Input nodes throws « View previous topic :: View next topic » 
Author Message
MikeOliverAZ
PostPosted: Sun Nov 17, 2013 7:01 pm    Post subject: Working WMB 8.0 Application with two MQ Input nodes throws Reply with quote

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
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Sun Nov 17, 2013 10:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
Esa
PostPosted: Mon Nov 18, 2013 1:32 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

What does the stack trace for the NPE say?
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Nov 18, 2013 1:46 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Set up the JVM to write a dump when it encounters the NPE:
http://pic.dhe.ibm.com/infocenter/java7sdk/v7r0/topic/com.ibm.java.aix.70.doc/diag/problem_determination/pd_first.html
http://pic.dhe.ibm.com/infocenter/java7sdk/v7r0/topic/com.ibm.java.aix.70.doc/diag/tools/diagnostics_summary.html

See the bottom of this page for how to trap an NPE and write a core dump:
http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/topic/com.ibm.java.doc.diagnostics.50/diag/tools/dumpagents_merge.html
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
MikeOliverAZ
PostPosted: Mon Nov 18, 2013 7:57 pm    Post subject: NPE not something special Reply with quote

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
View user's profile Send private message Send e-mail
Esa
PostPosted: Mon Nov 18, 2013 11:45 pm    Post subject: Re: NPE not something special Reply with quote

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
View user's profile Send private message
MikeOliverAZ
PostPosted: Tue Nov 19, 2013 3:28 am    Post subject: more info Reply with quote

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
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Nov 19, 2013 3:44 am    Post subject: Reply with quote

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
View user's profile Send private message
Esa
PostPosted: Tue Nov 19, 2013 5:01 am    Post subject: Reply with quote

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
View user's profile Send private message
MikeOliverAZ
PostPosted: Tue Nov 19, 2013 6:23 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Esa
PostPosted: Tue Nov 19, 2013 10:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Working WMB 8.0 Application with two MQ Input nodes throws
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.