Author |
Message
|
nathanw |
Posted: Wed Jan 30, 2013 9:12 am Post subject: Java Compute Node - evaluateXPath |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
Ok this has been implemented in the past and not by me I am just trying to find out why suddenly post V8 upgrade that the evaluateXPath function in a java compute node is failing in V8 when it worked in V6
The code snippet within the node is as follows (de-sensitised)
Code: |
MbMessage inMessage = contact admin.getMessage();
MbMessage outMessage = new MbMessage(inMessage);
MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin, outMessage);
String transferMnemonics= (String) inMessage.getRootElement().getFirstElementByPath("filepath").getValue();
String fileName = (String) inMessage.getRootElement().getFirstElementByPath("filename").getValue();
outMessage.getRootElement().getLastChild().detach();
MbElement outRoot = outMessage.getRootElement();
MbElement outBody = outRoot.createElementAsLastChild("XMLNSC");
// This block has changed to include file name in the trigger call
outMessage.evaluateXPath("/?is04_service_request/?@xmlns:xsi[set-value('http://www.w3.org/2001/XMLSchema-instance')]");
outMessage.evaluateXPath("/is04_service_request/?$action/?@step[set-value(1)]" ); |
the error being received is (again de-sensitised)
Code: |
2013-01-30 14:19:01.705552 5451 UserTrace BIP2231E: Error detected whilst processing a message in node 'NODENAME'.
The message broker detected an error whilst processing a message in node 'NODENAME'. The message has been augmented with an exception list and has been propagated to the node's failure terminal for further processing.
See the following messages for details of the error.
2013-01-30 14:19:01.705580 5451 RecoverableException BIP2230E: Error detected whilst processing a message in node 'NODENAME2'.
The message broker detected an error whilst processing a message in node 'NODENAME2'. An exception has been thrown to cut short the processing of the message.
See the following messages for details of the error.
2013-01-30 14:19:01.705588 5451 RecoverableException BIP4359E: XPath query ''/?is04_service_request/?@xmlns:xsi[set-value('http://www.w3.org/2001/XMLSchema-instance')]'' has an undefined namespace prefix ''xmlns''
All namespace prefixes in an XPath expression must be mapped to a namespace URI. The prefix quoted in the error message is not mapped.
If you created the XPath expression using the XPath Expression Builder in the Toolkit:
- Open the XPath Expression Builder.
- Expand the 'Namespace Settings' section.
- Add the prefix and its URI to the list.
- Redeploy the message flow.
If you supplied the XPath expression in a monitoring profile through a configurable service:
- Add a 'prefixMapping' element to the monitoring profile.
- Update the configurable service that contains the monitoring profile. |
So folks do we know of any changes in V8 that could have affected this? _________________ Who is General Failure and why is he reading my hard drive?
Artificial Intelligence stands no chance against Natural Stupidity.
Only the User Trace Speaks The Truth  |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jan 30, 2013 9:33 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
There is an APAR out related to the XERCES component of the WMB runtime about it running out of memory and generating errors like this. You'll need to open a PMR to get the APAR as the fix isn't scheduled for GA until next quarter. I don't have my notes any more about it, so I can't give you the number. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
nathanw |
Posted: Thu Jan 31, 2013 2:14 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
lancelotinc
thanks for the reply if you can find any info linking this i would be grateful _________________ Who is General Failure and why is he reading my hard drive?
Artificial Intelligence stands no chance against Natural Stupidity.
Only the User Trace Speaks The Truth  |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 31, 2013 4:54 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I don't think this is caused by that APAR. It looks like a simple configuration issue. Are you 100% sure that this worked OK in v6? Because there haven't been any major changes in this area for a long time.
Regardless, the error message is very specific about how to fix it - you need to declare all of the prefixes that your XPath expression uses. If v6 was allowing you to omit some of them then that was probably a defect in v6. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jan 31, 2013 4:57 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
kimbert wrote: |
you need to declare all of the prefixes that your XPath expression uses. If v6 was allowing you to omit some of them then that was probably a defect in v6. |
This is done by creating an MbXPath object, and setting the namespace prefixes on that object before executing the query.
Using xpath for this simple a task, however, seems a bit unnecessary. |
|
Back to top |
|
 |
nathanw |
Posted: Fri Feb 01, 2013 6:29 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
as an update talking about this with IBM the initial response was they were not sure if this was a XPATH expression issue or an underlying issue with the XPATH engine itself.
@kimbert I agree about the defect in V6 as we have had similar points to ponder in the past where we have had to change a line of esql in V8.
I am looking at the expression side of things as well as waiting for response from IBM
Thanks for all your inputs so far _________________ Who is General Failure and why is he reading my hard drive?
Artificial Intelligence stands no chance against Natural Stupidity.
Only the User Trace Speaks The Truth  |
|
Back to top |
|
 |
kimbert |
Posted: Fri Feb 01, 2013 9:24 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
talking about this with IBM the initial response was they were not sure if this was a XPATH expression issue or an underlying issue with the XPATH engine itself. |
It's 'neither of the above'.
The XPath specification requires that every namespace prefix is mapped to a URL. It doesn't say how this mapping should be done. The WMB Java API does it in the way described by mqjeff above. |
|
Back to top |
|
 |
nathanw |
Posted: Tue Feb 05, 2013 4:11 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
As an update
"We" have coded a work around to this issue.
The original code was
Code: |
outMessage.evaluateXPath("/?is04_service_request/?@xmlns:xsi[set-value('http://www.w3.org/2001/XMLSchema-instance')]"); |
This was changed to be
Code: |
outMessage.evaluateXPath("/?is04_service_request"); |
The process now works with the javanode initiating the application trigger to read the file.
I can only assume that V6 worked the same way but ignored the second portion whereas V8 reads the entire portion and was trying to use the data and failing as it was not a real "link"
As ever thanks for the advice chaps.
I have informed IBM of the change and that if they have anything further to add then they should let us know. _________________ Who is General Failure and why is he reading my hard drive?
Artificial Intelligence stands no chance against Natural Stupidity.
Only the User Trace Speaks The Truth  |
|
Back to top |
|
 |
kimbert |
Posted: Tue Feb 05, 2013 5:16 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I can only assume that V6 worked the same way but ignored the second portion whereas V8 reads the entire portion and was trying to use the data and failing as it was not a real "link" |
I cannot work out why you are assuming that. The error message was very specific: you did not provide bindings for all of the namespace prefixes in the query. WMB v8 is applying that rule strictly - as v6.1 should have done.
What am I missing? ( Vitor and mqjeff: polite answers only, please ) |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 05, 2013 5:18 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
kimbert wrote: |
What am I missing? ( Vitor and mqjeff: polite answers only, please ) |
If I phrase it in the form of a question, is it still an answer? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 05, 2013 5:31 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
What am I missing? ( Vitor and mqjeff: polite answers only, please ) |
That hurts. As the truth often does. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Feb 05, 2013 10:48 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
kimbert wrote: |
Quote: |
I can only assume that V6 worked the same way but ignored the second portion whereas V8 reads the entire portion and was trying to use the data and failing as it was not a real "link" |
I cannot work out why you are assuming that. The error message was very specific: you did not provide bindings for all of the namespace prefixes in the query. WMB v8 is applying that rule strictly - as v6.1 should have done.
What am I missing? ( Vitor and mqjeff: polite answers only, please ) |
Don't think you're missing anything at all. As I remember V7 already worked the correct way. So this might be strictly a V6 problem...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Feb 06, 2013 2:04 am Post subject: Re: Java Compute Node - evaluateXPath |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
nathanw wrote: |
Code: |
outMessage.evaluateXPath("/?is04_service_request/?@xmlns:xsi[set-value('http://www.w3.org/2001/XMLSchema-instance')]"); |
|
'@' is the wrong axis-specifier to use for namespace declarations. Use 'namespace::' instead.
kimbert wrote: |
Regardless, the error message is very specific about how to fix it - you need to declare all of the prefixes that your XPath expression uses. |
The XML namespace standard prohibits an explicit declaration for the 'xmlns' prefix itself. MbXPath should not require adding a namespace prefix for it.
It's more likely that the error is indirectly due to the wrong axis-specifier. The 'xmlns' prefix is meant only for namespace declarations, not for other attributes. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Feb 06, 2013 5:45 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
The XML namespace standard prohibits an explicit declaration for the 'xmlns' prefix itself. MbXPath should not require adding a namespace prefix for it. |
That's a very good point - thanks.
Quote: |
It's more likely that the error is indirectly due to the wrong axis-specifier. The 'xmlns' prefix is meant only for namespace declarations, not for other attributes. |
Right - so the error message is insisting on the 'xmlns' prefix only because the axis specifier says that this is a normal attribute. That's a theory worth following up on. |
|
Back to top |
|
 |
|