Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using XPath 2.0 in Integrator Studio 8.2.0 #2257

Closed
TomasWso2 opened this issue Nov 2, 2023 · 0 comments · Fixed by wso2/integration-studio#1264
Closed

Error when using XPath 2.0 in Integrator Studio 8.2.0 #2257

TomasWso2 opened this issue Nov 2, 2023 · 0 comments · Fixed by wso2/integration-studio#1264

Comments

@TomasWso2
Copy link

Description

We were able to reproduce this issue in Integrator Studio 8.2.0 for Windows and Linux.
We tried the same in the latest update level of wso2mi-4.2.0 and it works.

Error stack trace:

[2023-11-02 15:40:26,998] ERROR {org.apache.synapse.util.xpath.SynapseXPath} - Evaluation of the XPath expression fn:replace("abracadabra", "bra", "*") resulted in an error
javax.xml.transform.TransformerException: java.lang.NullPointerException
at java.xml/com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider.extFunction(JAXPExtensionsProvider.java:205)
at java.xml/com.sun.org.apache.xpath.internal.functions.FuncExtFunction.execute(FuncExtFunction.java:210)
at java.xml/com.sun.org.apache.xpath.internal.XPath.execute(XPath.java:339)
at java.xml/com.sun.org.apache.xpath.internal.XPath.execute(XPath.java:305)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImplUtil.eval(XPathImplUtil.java:101)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:80)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:89)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:111)
at org.apache.synapse.util.xpath.SynapseXPath.evaluateDOMXPath(SynapseXPath.java:677)
at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(SynapseXPath.java:510)
at org.apache.synapse.mediators.MediatorProperty.getEvaluatedExpression(MediatorProperty.java:144)
at org.apache.synapse.mediators.builtin.LogMediator.setCustomProperties(LogMediator.java:236)
at org.apache.synapse.mediators.builtin.LogMediator.getCustomLogMessage(LogMediator.java:153)
at org.apache.synapse.mediators.builtin.LogMediator.getLogMessage(LogMediator.java:139)
at org.apache.synapse.mediators.builtin.LogMediator.mediate(LogMediator.java:108)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:110)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.api.Resource.process(Resource.java:342)
at org.apache.synapse.api.API.process(API.java:477)
at org.apache.synapse.api.AbstractApiHandler.apiProcess(AbstractApiHandler.java:94)
at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:72)
at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:90)
at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:76)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:346)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:101)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:379)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:193)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
at java.xml/com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider.extFunction(JAXPExtensionsProvider.java:198)
... 33 more


java.lang.NullPointerException
at java.xml/com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider.extFunction(JAXPExtensionsProvider.java:198)
at java.xml/com.sun.org.apache.xpath.internal.functions.FuncExtFunction.execute(FuncExtFunction.java:210)
at java.xml/com.sun.org.apache.xpath.internal.XPath.execute(XPath.java:339)
at java.xml/com.sun.org.apache.xpath.internal.XPath.execute(XPath.java:305)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImplUtil.eval(XPathImplUtil.java:101)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:80)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:89)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:111)
at org.apache.synapse.util.xpath.SynapseXPath.evaluateDOMXPath(SynapseXPath.java:677)
at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(SynapseXPath.java:510)
at org.apache.synapse.mediators.MediatorProperty.getEvaluatedExpression(MediatorProperty.java:144)
at org.apache.synapse.mediators.builtin.LogMediator.setCustomProperties(LogMediator.java:236)
at org.apache.synapse.mediators.builtin.LogMediator.getCustomLogMessage(LogMediator.java:153)
at org.apache.synapse.mediators.builtin.LogMediator.getLogMessage(LogMediator.java:139)
at org.apache.synapse.mediators.builtin.LogMediator.mediate(LogMediator.java:108)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:110)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.api.Resource.process(Resource.java:342)
at org.apache.synapse.api.API.process(API.java:477)
at org.apache.synapse.api.AbstractApiHandler.apiProcess(AbstractApiHandler.java:94)
at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:72)
at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:90)
at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:76)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:346)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:101)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:379)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:193)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
--------------- linked to ------------------
javax.xml.xpath.XPathExpressionException: javax.xml.transform.TransformerException: java.lang.NullPointerException
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:102)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:111)
at org.apache.synapse.util.xpath.SynapseXPath.evaluateDOMXPath(SynapseXPath.java:677)
at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(SynapseXPath.java:510)
at org.apache.synapse.mediators.MediatorProperty.getEvaluatedExpression(MediatorProperty.java:144)
at org.apache.synapse.mediators.builtin.LogMediator.setCustomProperties(LogMediator.java:236)
at org.apache.synapse.mediators.builtin.LogMediator.getCustomLogMessage(LogMediator.java:153)
at org.apache.synapse.mediators.builtin.LogMediator.getLogMessage(LogMediator.java:139)
at org.apache.synapse.mediators.builtin.LogMediator.mediate(LogMediator.java:108)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:110)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.api.Resource.process(Resource.java:342)
at org.apache.synapse.api.API.process(API.java:477)
at org.apache.synapse.api.AbstractApiHandler.apiProcess(AbstractApiHandler.java:94)
at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:72)
at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:90)
at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:76)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:346)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:101)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:379)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:193)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.xml.transform.TransformerException: java.lang.NullPointerException
at java.xml/com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider.extFunction(JAXPExtensionsProvider.java:205)
at java.xml/com.sun.org.apache.xpath.internal.functions.FuncExtFunction.execute(FuncExtFunction.java:210)
at java.xml/com.sun.org.apache.xpath.internal.XPath.execute(XPath.java:339)
at java.xml/com.sun.org.apache.xpath.internal.XPath.execute(XPath.java:305)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImplUtil.eval(XPathImplUtil.java:101)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:80)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:89)
... 27 more
Caused by: java.lang.NullPointerException
at java.xml/com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider.extFunction(JAXPExtensionsProvider.java:198)
... 33 more

Steps to Reproduce

Steps:

  1. Create an API which uses XPATH functions.
    example:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/test" name="Test" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="GET">
        <inSequence>
            <log level="custom">
                <property expression="fn:replace(&quot;abracadabra&quot;, &quot;bra&quot;, &quot;*&quot;)" name="tags" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ns="http://org.apache.synapse/xsd"/>
            </log>
            <respond/>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </resource>
</api>
  1. Run with the enbedded MI server.
  2. Add the following config to the emedded deployment.toml and save.
    [mediation]
    synapse.enable_xpath_dom_failover=true
  3. Invoke the API.

Affected Component

IntegrationStudio

Version

8.2.0

Environment Details (with versions)

No response

Relevant Log Output

No response

Related Issues

No response

Suggested Labels

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant