[
https://issues.apache.org/jira/browse/NIFI-1752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15235704#comment-15235704
]
James Wing commented on NIFI-1752:
----------------------------------
The underlying exception, "javax.xml.xpath.XPathFactoryConfigurationException:
No XPathFactory implementation found for the object model:
http://saxon.sf.net/jaxp/xpath/om" is thrown by XPathValidator while executing
on EvaluateXPath.java:436:
{code}
XPathFactory factory =
XPathFactory.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);
{code}
>From watching in the debugger, *sometimes* the exception is thrown, but also
>*sometimes not* - and validation continues to compile the expression
>successfully and validate the property (seen by watching
>{{evaluator.compile(input);}} on line 441).
One possible explanation would be multi-threading. There are several
validation operations in progress at the time the exceptions occur. And the
[documentation for
XPathFactory|https://docs.oracle.com/javase/7/docs/api/javax/xml/xpath/XPathFactory.html]
states that it is not thread safe.
bq. The XPathFactory class is not thread-safe. In other words, it is the
application's responsibility to ensure that at most one thread is using a
XPathFactory object at any given moment. Implementations are encouraged to mark
methods as synchronized to protect themselves from broken clients.
I made an experimental change to synchronize the creation and use of
XPathFactory, and that seems to resolve the issue on my machine. But I'm not
sure how multi-threading would relate to changes introduced in 0.6.0. Proving
that multi-threading is or is not the actual problem and that a {{synchronize}}
block is the right fix is the next step.
> EvaluateXPath invalid when starting processor
> ---------------------------------------------
>
> Key: NIFI-1752
> URL: https://issues.apache.org/jira/browse/NIFI-1752
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 0.6.0
> Reporter: Joseph Witt
> Fix For: 1.0.0, 0.7.0, 0.6.1
>
>
> Guillaume Pool:
> Hi,
>
> If anyone could help I would appreciate it:
>
> After upgrading to 0.6.0 all my EvaluateXMLPath processors report as invalid
> with nothing specific reported as the error.
>
> I use flowfile attribute as the destination, xpath query similar to
> /message/address
>
> Return type auto-detect / string
>
> Error:
>
> 2016-04-11 17:37:12,465 INFO [NiFi Web Server-64629]
> org.apache.nifi.web.filter.RequestLogger Attempting request for (anonymous)
> PUT
> http://sv-hdpdf1.hdp.supergrp.net:8443/nifi-api/controller/process-groups/d02a0bbc-c142-37ba-adaa-ee191b98790d/processors/e49acf40-76d1-3b6e-a67d-dc40153605ad
> (source ip: 172.27.0.97)
> 2016-04-11 17:37:12,474 INFO [NiFi Web Server-64629]
> o.a.n.w.a.c.IllegalStateExceptionMapper java.lang.IllegalStateException:
> EvaluateXPath[id=e49acf40-76d1-3b6e-a67d-dc40153605ad] is not in a valid
> state. Returning Conflict response.
>
> Reports this even if you drop a new processor in.
> James Wing:
> I am able to see the same EvaluateXPath issue Guillame Pool reported on NiFi
> 0.6.0. I created a template gist at
> https://gist.github.com/jvwing/7e7948d8eb5ad3643f38966b4ba3ce2e that
> illustrates this for me. You don't even need to run the whole thing, just
> try to start the EvaluateXPath processor. I see a pop-up error trying to
> start it "EvaluateXPath[id=b481c570-686a-4b6e-859c-9ebe27398fe1] is not in a
> valid state".
> Trying to troubleshoot this, I attached a debugger and found an
> IllegalStateException thrown by StandardProcessorNode.verifyCanStart() on
> line 1141. The error text was:
> 'address' validated against '/message/address' is invalid because Unable to
> initialize XPath engine due to
> javax.xml.xpath.XPathFactoryConfigurationException: No XPathFactory
> implementation found for the object model: http://saxon.sf.net/jaxp/xpath/om
> I haven't figured out what change is the root cause, but the trail seems to
> lead into validating the dynamic XPath attribute.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)