ODE
  1. ODE
  2. ODE-536

NullPointerException during ASSIGN of complex node returned from XQuery

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.2
    • Fix Version/s: 1.3.2
    • Component/s: JBI Integration
    • Labels:
      None
    • Environment:
      ServiceMix 3.3

      Description

      I did a following xquery assign:

      <assign name="assign1">
      <copy>
      <from expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xquery1.0">
      <![CDATA[
      for $loopOnce in (1)
      return
      <test:test1>
      <test:test2>abc</test:test2>
      </test:test1>
      ]]>
      </from>
      <to variable="myVar" part="TestPart"/>
      </copy>
      </assign>

      and run it in servicemix.
      I got:

      13:26:57,703 | ERROR | pool-4-thread-1 | BpelEngineImpl | ode.bpel.engine.BpelEngineImpl 433 | Scheduled job failed; jobDetail={type=INVOKE_INTERNAL, mexid=65536, pid=

      {http://ode/bpel/unit-test}

      HelloXQueryWorld-1}
      java.lang.RuntimeException: java.lang.NullPointerException
      at org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:464)
      at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
      at org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntimeContextImpl.java:847)
      at org.apache.ode.bpel.engine.PartnerLinkMyRoleImpl.invokeNewInstance(PartnerLinkMyRoleImpl.java:206)
      at org.apache.ode.bpel.engine.BpelProcess.invokeProcess(BpelProcess.java:215)
      at org.apache.ode.bpel.engine.BpelProcess.handleWorkEvent(BpelProcess.java:402)
      at org.apache.ode.bpel.engine.BpelEngineImpl.onScheduledJob(BpelEngineImpl.java:424)
      at org.apache.ode.bpel.engine.BpelServerImpl.onScheduledJob(BpelServerImpl.java:377)
      at org.apache.ode.scheduler.simple.SimpleScheduler$4$1.call(SimpleScheduler.java:386)
      at org.apache.ode.scheduler.simple.SimpleScheduler$4$1.call(SimpleScheduler.java:380)
      at org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(SimpleScheduler.java:208)
      at org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:379)
      at org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:376)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
      at java.util.concurrent.FutureTask.run(FutureTask.java:123)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NullPointerException
      at org.apache.xerces.dom.CoreDocumentImpl.importNode(Unknown Source)
      at org.apache.xerces.dom.CoreDocumentImpl.importNode(Unknown Source)
      at org.apache.ode.bpel.runtime.ASSIGN.replaceElement(ASSIGN.java:489)
      at org.apache.ode.bpel.runtime.ASSIGN.copy(ASSIGN.java:416)
      at org.apache.ode.bpel.runtime.ASSIGN.run(ASSIGN.java:81)
      at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:451)
      ... 17 more

      I noticed that this example run successfully in ODE tests. I saw that a difference is that evaluated node list is of Xerces DOM impl in ODE tests, and Saxon DOM impl in Servicemix.

      1. assignmentForXQuery.diff
        2 kB
        Rafal Rusin
      2. ode-536-namespace.patch
        0.7 kB
        Colin
      3. xqueryComplexAssign.zip
        12 kB
        Rafal Rusin

        Activity

        Rafal Rusin created issue -
        Hide
        Rafal Rusin added a comment -

        Here is a test SA and a test request:
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:unit="http://ode/bpel/unit-test.wsdl">
        <soapenv:Header/>
        <soapenv:Body>
        <unit:HelloXQuery>
        <TestPart>
        asdgasdg
        </TestPart>
        </unit:HelloXQuery>
        </soapenv:Body>
        </soapenv:Envelope>

        Show
        Rafal Rusin added a comment - Here is a test SA and a test request: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:unit="http://ode/bpel/unit-test.wsdl"> <soapenv:Header/> <soapenv:Body> <unit:HelloXQuery> <TestPart> asdgasdg </TestPart> </unit:HelloXQuery> </soapenv:Body> </soapenv:Envelope>
        Rafal Rusin made changes -
        Field Original Value New Value
        Attachment xqueryComplexAssign.zip [ 12401307 ]
        Hide
        Rafal Rusin added a comment -

        Here is a workaround.
        It does a Saxon DOM -> String -> Xerces DOM conversion.

        Show
        Rafal Rusin added a comment - Here is a workaround. It does a Saxon DOM -> String -> Xerces DOM conversion.
        Rafal Rusin made changes -
        Attachment assignmentForXQuery.diff [ 12401310 ]
        Hide
        Rafal Rusin added a comment -

        Here's evaluation result from ODE tests (working):
        03-03@14:15:14 DEBUG (XQuery10ExpressionRuntime.java:408) - Expression

        {OXPath10Expression null} generated result [[test:test1: null]] - type=java.util.ArrayList

        And here's from Servicemix (not working):
        14:04:30,594 | DEBUG | pool-4-thread-1 | Query10ExpressionRuntime | time.XQuery10ExpressionRuntime 401 | Expression {OXPath10Expression null}

        generated result [net.sf.saxon.dom.ElementOverNodeInfo@eaa827] - type=java.util.ArrayList

        Show
        Rafal Rusin added a comment - Here's evaluation result from ODE tests (working): 03-03@14:15:14 DEBUG (XQuery10ExpressionRuntime.java:408) - Expression {OXPath10Expression null} generated result [ [test:test1: null] ] - type=java.util.ArrayList And here's from Servicemix (not working): 14:04:30,594 | DEBUG | pool-4-thread-1 | Query10ExpressionRuntime | time.XQuery10ExpressionRuntime 401 | Expression {OXPath10Expression null} generated result [net.sf.saxon.dom.ElementOverNodeInfo@eaa827] - type=java.util.ArrayList
        Rafal Rusin made changes -
        Attachment assignmentForXQuery2.diff [ 12401316 ]
        Rafal Rusin made changes -
        Attachment assignmentForXQuery2.diff [ 12401316 ]
        Rafal Rusin made changes -
        Comment [ It looks like it's enough to set
        configuration.setTreeModel(net.sf.saxon.event.Builder.STANDARD_TREE);

        istead of using default TINY_TREE to enable correct Xerces DOM importing.
        I attached a patch.
        ]
        Alex Boisvert made changes -
        Assignee Karthick Sankarachary [ karthick ]
        Hide
        Karthick Sankarachary added a comment -

        You typically run into this type of problem if you're dealing with (a) multiple parser implementations and (b) the node being imported or cloned does not have a owner document or parent. This is precisely why I took matters into my own hand and wrote a fool-proof method (see DomUtils.cloneNode) specifically for the purpose of cloning nodes across different implementations.

        I believe the right way to resolve this issue is to use the aforementioned method in the ASSIGN activity (please see revision 749796) . Can you please give it a shot and let me know if it works in the context of JBI?

        Show
        Karthick Sankarachary added a comment - You typically run into this type of problem if you're dealing with (a) multiple parser implementations and (b) the node being imported or cloned does not have a owner document or parent. This is precisely why I took matters into my own hand and wrote a fool-proof method (see DomUtils.cloneNode) specifically for the purpose of cloning nodes across different implementations. I believe the right way to resolve this issue is to use the aforementioned method in the ASSIGN activity (please see revision 749796) . Can you please give it a shot and let me know if it works in the context of JBI?
        Karthick Sankarachary made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Rafal Rusin added a comment -

        Thanks, it works in JBI.
        You are right, a cause for this was that there was no owner document for evaluated expression nodes. So Xerces' import method did not work.

        Show
        Rafal Rusin added a comment - Thanks, it works in JBI. You are right, a cause for this was that there was no owner document for evaluated expression nodes. So Xerces' import method did not work.
        Hide
        Ciaran Jessup added a comment -

        These changes appear to have broken our BPEL flows We're now getting the following exceptions when the flow tries to assign the response of a web-service call to a variable in the workflow:

        ERROR - GeronimoLog.error(108) | Error while executing transaction
        org.apache.ode.bpel.iapi.Scheduler$JobProcessorException: java.lang.RuntimeException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or c
        hange an object in a way which is incorrect with regard to namespaces.
        at org.apache.ode.bpel.engine.BpelEngineImpl.onScheduledJob(BpelEngineImpl.java:409)
        at org.apache.ode.bpel.engine.BpelServerImpl.onScheduledJob(BpelServerImpl.java:390)
        at org.apache.ode.scheduler.simple.SimpleScheduler$4$1.call(SimpleScheduler.java:386)
        at org.apache.ode.scheduler.simple.SimpleScheduler$4$1.call(SimpleScheduler.java:380)
        at org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(SimpleScheduler.java:208)
        at org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:379)
        at org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:376)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
        Caused by: java.lang.RuntimeException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect wit
        h regard to namespaces.
        at org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:464)
        at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
        at org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntimeContextImpl.java:868)
        at org.apache.ode.bpel.engine.BpelProcess.handleWorkEvent(BpelProcess.java:441)
        at org.apache.ode.bpel.engine.BpelEngineImpl.onScheduledJob(BpelEngineImpl.java:399)
        ... 11 more
        Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
        at org.apache.xerces.dom.CoreDocumentImpl.checkDOMNSErr(Unknown Source)
        at org.apache.xerces.dom.ElementNSImpl.setName(Unknown Source)
        at org.apache.xerces.dom.ElementNSImpl.<init>(Unknown Source)
        at org.apache.xerces.dom.CoreDocumentImpl.createElementNS(Unknown Source)
        at org.apache.ode.utils.DOMUtils.cloneNode(DOMUtils.java:1154)
        at org.apache.ode.bpel.runtime.ASSIGN.replaceElement(ASSIGN.java:490)
        at org.apache.ode.bpel.runtime.ASSIGN.copy(ASSIGN.java:416)
        at org.apache.ode.bpel.runtime.ASSIGN.run(ASSIGN.java:81)
        at sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:451)
        ... 15 more

        Any ideas?

        Show
        Ciaran Jessup added a comment - These changes appear to have broken our BPEL flows We're now getting the following exceptions when the flow tries to assign the response of a web-service call to a variable in the workflow: ERROR - GeronimoLog.error(108) | Error while executing transaction org.apache.ode.bpel.iapi.Scheduler$JobProcessorException: java.lang.RuntimeException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or c hange an object in a way which is incorrect with regard to namespaces. at org.apache.ode.bpel.engine.BpelEngineImpl.onScheduledJob(BpelEngineImpl.java:409) at org.apache.ode.bpel.engine.BpelServerImpl.onScheduledJob(BpelServerImpl.java:390) at org.apache.ode.scheduler.simple.SimpleScheduler$4$1.call(SimpleScheduler.java:386) at org.apache.ode.scheduler.simple.SimpleScheduler$4$1.call(SimpleScheduler.java:380) at org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(SimpleScheduler.java:208) at org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:379) at org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:376) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.RuntimeException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect wit h regard to namespaces. at org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:464) at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139) at org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntimeContextImpl.java:868) at org.apache.ode.bpel.engine.BpelProcess.handleWorkEvent(BpelProcess.java:441) at org.apache.ode.bpel.engine.BpelEngineImpl.onScheduledJob(BpelEngineImpl.java:399) ... 11 more Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces. at org.apache.xerces.dom.CoreDocumentImpl.checkDOMNSErr(Unknown Source) at org.apache.xerces.dom.ElementNSImpl.setName(Unknown Source) at org.apache.xerces.dom.ElementNSImpl.<init>(Unknown Source) at org.apache.xerces.dom.CoreDocumentImpl.createElementNS(Unknown Source) at org.apache.ode.utils.DOMUtils.cloneNode(DOMUtils.java:1154) at org.apache.ode.bpel.runtime.ASSIGN.replaceElement(ASSIGN.java:490) at org.apache.ode.bpel.runtime.ASSIGN.copy(ASSIGN.java:416) at org.apache.ode.bpel.runtime.ASSIGN.run(ASSIGN.java:81) at sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:451) ... 15 more Any ideas?
        Karthick Sankarachary made changes -
        Status Resolved [ 5 ] Reopened [ 4 ]
        Resolution Fixed [ 1 ]
        Hide
        Karthick Sankarachary added a comment -

        Ciaran,

        Can you attach a test case, if at all possible?

        Regards,
        Karthick

        Show
        Karthick Sankarachary added a comment - Ciaran, Can you attach a test case, if at all possible? Regards, Karthick
        Hide
        Ciaran Jessup added a comment -

        Not easily, our processes are quite complex/large, but they did work ( well to an extent, but didn't fall over in this way) prior to the DomUtils.clone changes, and they work in other BPEL containers. If I can get a test case together I'll submit one, but I don't hold out a lot of hope I'm flat out on too many things at once at the moment

        Show
        Ciaran Jessup added a comment - Not easily, our processes are quite complex/large, but they did work ( well to an extent, but didn't fall over in this way) prior to the DomUtils.clone changes, and they work in other BPEL containers. If I can get a test case together I'll submit one, but I don't hold out a lot of hope I'm flat out on too many things at once at the moment
        Hide
        Karthick Sankarachary added a comment -

        Okay, in that case, can you please check out revision 750103? It performs certain additional sanity checks that just might resolve your issue. In case it doesn't, can you attach snippets of the BPEL file(s) that you think might be involved?

        Show
        Karthick Sankarachary added a comment - Okay, in that case, can you please check out revision 750103? It performs certain additional sanity checks that just might resolve your issue. In case it doesn't, can you attach snippets of the BPEL file(s) that you think might be involved?
        Hide
        Ciaran Jessup added a comment -

        Unfortunately I won't be able to do this until tomorrow morning (GMT), but yes no problem. The bpel that is now failing is trivial, it is assigning a BPEL variable to the WSDL message that is returned from the ODE instance, there is very little to go wrong, it looks as though that assign is attempting to add in a new default namespace during the clone (the elements being added are geting an xmlns: prefix (which looked odd to me naive eyes!)

        Show
        Ciaran Jessup added a comment - Unfortunately I won't be able to do this until tomorrow morning (GMT), but yes no problem. The bpel that is now failing is trivial, it is assigning a BPEL variable to the WSDL message that is returned from the ODE instance, there is very little to go wrong, it looks as though that assign is attempting to add in a new default namespace during the clone (the elements being added are geting an xmlns: prefix (which looked odd to me naive eyes!)
        Hide
        Colin added a comment -

        The last change to this class seems to have allowed non NS Elements to be created despite a namespace being found. Is the behaviour intended?

        Show
        Colin added a comment - The last change to this class seems to have allowed non NS Elements to be created despite a namespace being found. Is the behaviour intended?
        Colin made changes -
        Attachment ode-536-namespace.patch [ 12401520 ]
        Hide
        Karthick Sankarachary added a comment -

        Rafal,

        On second thought, it probably wasn't prudent of me to change the ASSIGN activity to fix your original issue. Hence, I've rolled back my changes to the ASSIGN activity. If nothing else, that should address the issue that Ciaran brought up.

        I've a sneaky suspicion that your original issue was due to the fact that your JBI environment did not have the latest and greatest ODE libraries. Can you please run your test again, after making sure that your JBI environment is on the same page as the latest ODE branch?

        Regards,
        Karthick

        Show
        Karthick Sankarachary added a comment - Rafal, On second thought, it probably wasn't prudent of me to change the ASSIGN activity to fix your original issue. Hence, I've rolled back my changes to the ASSIGN activity. If nothing else, that should address the issue that Ciaran brought up. I've a sneaky suspicion that your original issue was due to the fact that your JBI environment did not have the latest and greatest ODE libraries. Can you please run your test again, after making sure that your JBI environment is on the same page as the latest ODE branch? Regards, Karthick
        Hide
        Karthick Sankarachary added a comment -

        Rafal, If the problem re-surfaces, please re-open this issue.

        Show
        Karthick Sankarachary added a comment - Rafal, If the problem re-surfaces, please re-open this issue.
        Karthick Sankarachary made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Rafal Rusin added a comment -

        I rebuilt current revision (749939) and it's OK here.
        Thanks

        Show
        Rafal Rusin added a comment - I rebuilt current revision (749939) and it's OK here. Thanks
        Alexis Midon made changes -
        Fix Version/s 1.3.1 [ 12313680 ]
        Fix Version/s 1.3 [ 12313165 ]
        Alexis Midon made changes -
        Affects Version/s 1.3.1 [ 12313680 ]
        Affects Version/s 1.3 [ 12313165 ]
        Karthick Sankarachary made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Alexis Midon made changes -
        Affects Version/s 1.3.2 [ 12313906 ]
        Affects Version/s 1.3.1 [ 12313680 ]
        Fix Version/s 1.3.2 [ 12313906 ]
        Fix Version/s 1.3.1 [ 12313680 ]

          People

          • Assignee:
            Karthick Sankarachary
            Reporter:
            Rafal Rusin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development