commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul Akolkar <rahul.akol...@gmail.com>
Subject Re: [SCXML] XPathEvaluator / Error accessing complex event payload
Date Tue, 03 Nov 2009 18:53:31 GMT
On Tue, Nov 3, 2009 at 6:52 AM, Jaroslav Pullmann
<jaroslav.pullmann@fit.fraunhofer.de> wrote:
>
>
>  Hello Rahul,
>  sorry for the late response, I've been out of office last week.
>  I looked at the code once again and found the error cause. The payload
>  was in deed wrapped into a bean with a dedicated accessor method
>  Node getPayload(), instead of passing the node directly. This worked
>  only with the Jexl-evaluator..
>
<snip/>

Cool, makes sense.

-Rahul


>  Please find attached the extended test suite for XPath. This may
>  be of interest for other users in a comparative documentation of
>  the XPath-based access to event payload and data models        .
>   Best regards
>    Jaro
>
>
>
>
> Rahul Akolkar wrote:
>>
>> On Sun, Oct 25, 2009 at 11:47 AM, Jaroslav Pullmann
>> <jaroslav.pullmann@fit.fraunhofer.de> wrote:
>>>
>>>  Hello Rahul,
>>>  although not yet officially released I like using the J6 branch
>>>  (commons-scxml-1.0-SNAPSHOT.jar) because of its XPath support.
>>>  Recently I experience problems when accessing the complex event
>>>  payload (Node: <payload><data><status>started</status></data></payload>,
>>>  plain string payload is o.k.)
>>>
>>>  This works fine with JexlEvaluator:
>>>
>>>       <transition event="statuschange">
>>>               <log label="Status changed to"
>>> expr="Data(_eventdata.payload,'/data/status')"/>
>>>       </transition>
>>>
>>>  but is broken with XPathEvaluator:
>>>
>>>       <transition event="statuschange">
>>>               <log label="Message" expr="$_eventdata/data/status"/>
>>>       </transition>
>>>
>> <snip/>
>>
>> The two evaluators handle XPath processing differently, so in order to
>> track down the error below, please say more as to how you obtained the
>> Node that became the event payload. For example, if the
>> DocumentBuilder API is used to parse the above XML, I'd expect it to
>> work in either cases. I would, however, expect the expression when
>> using the XPath evaluator in this case to be either
>> "$_eventdata/payload/data/status" or "$_eventdata//data/status" (note
>> two /s before data). As an aside, for good measure, specifying an
>> xmlns on payloads is also recommended practice i.e. <payload
>> xmlns="">...</payload>.
>>
>> Also say something about the environment and how we're seeing xalan
>> classes in the traces that aren't repackaged. The J6 branch requires
>> JDK 1.6 where, for example, I'd expect to see something like
>> com.sun.org.apache.xpath.internal.XPath as against
>> org.apache.xpath.XPath in the traces.
>>
>> In order for us to reproduce this, if you can produce a small JUnit
>> test case in the Commons SCXML test suite (see existing ones in
>> src/test/java/...oacse.../xpath) that produces the trace below, that
>> can also help.
>>
>> -Rahul
>>
>>
>>> javax.xml.transform.TransformerException:
>>> org.apache.xpath.objects.XObject
>>> incompatible with org.apache.xpath.objects.XNodeSet
>>>       at org.apache.xpath.XPath.execute(Unknown Source)
>>>       at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(Unknown
>>> Source)
>>>       at org.apache.xpath.jaxp.XPathImpl.evaluate(Unknown Source)
>>>       at
>>>
>>> org.apache.commons.scxml.env.xpath.XPathEvaluator.eval(XPathEvaluator.java:90)
>>>       at org.apache.commons.scxml.model.Log.execute(Log.java:107)
>>>       at
>>>
>>> org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.executeActions(SCXMLSemanticsImpl.java:223)
>>>       at
>>>
>>> org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:131)
>>>
>>> Caused by: java.lang.ClassCastException: org.apache.xpath.objects.XObject
>>> incompatible with org.apache.xpath.objects.XNodeSet
>>>       at
>>> org.apache.xpath.axes.FilterExprIteratorSimple.executeFilterExpr(Unknown
>>> Source)
>>>       at org.apache.xpath.axes.FilterExprWalker.setRoot(Unknown Source)
>>>       at org.apache.xpath.axes.WalkingIterator.setRoot(Unknown Source)
>>>       at org.apache.xpath.axes.NodeSequence.setRoot(Unknown Source)
>>>       at org.apache.xpath.axes.LocPathIterator.execute(Unknown Source)
>>>       ... 13 more
>>>
>>>
>>>       Is this may be due to an incorrect variable naming or whichever
>>> user
>>> error ?
>>>
>>>   Many thanks for your help!
>>>     Jaro
>>>
>>>
>
>
> --
> Jaroslav Pullmann
> Web Compliance Center - Fraunhofer FIT
> Schloss Birlinghoven, D-53757 Sankt Augustin, Germany
> Phone: +49-2241-142623    Fax: +49-2241-142065
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message