Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-7307

"IllegalArgumentException: Unknown node id" when migrating MultiInstance

    Details

      Description

      When migrating a process instance with MultiInstance subprocess, "IllegalArgumentException: Unknown node id" is thrown. It happens when the MultiInstance node's nodeId is changed by the migration.

      2018-05-24 14:50:55,750 [main] [org.jbpm.runtime.manager.impl.migration.MigrationManager] ERROR Unexpected error during migration
      java.lang.IllegalArgumentException: Unknown node id: 2 for node instance 1:4 for process instance WorkflowProcessInstance1 [processId=MultiInstance-1,state=1]
      	at org.jbpm.workflow.instance.impl.NodeInstanceImpl.getNode(NodeInstanceImpl.java:137) ~[jbpm-flow-7.8.0-SNAPSHOT.jar:7.8.0-SNAPSHOT]
      	at org.jbpm.runtime.manager.impl.migration.MigrationManager.updateNodeInstances(MigrationManager.java:381) [classes/:na]
      	at org.jbpm.runtime.manager.impl.migration.MigrationManager.updateNodeInstances(MigrationManager.java:460) [classes/:na]
      	at org.jbpm.runtime.manager.impl.migration.MigrationManager.upgradeProcessInstance(MigrationManager.java:369) [classes/:na]
      	at org.jbpm.runtime.manager.impl.migration.MigrationManager.migrate(MigrationManager.java:239) [classes/:na]
      	at org.jbpm.runtime.manager.impl.migration.MigrationManager.migrate(MigrationManager.java:119) [classes/:na]
      	at org.jbpm.runtime.manager.impl.migration.MigrationManagerTest.testMigrateMultiInstance(MigrationManagerTest.java:626) [test-classes/:na]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_66]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_66]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_66]
      	at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_66]
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) [junit-4.12.jar:4.12]
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) [junit-4.12.jar:4.12]
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.12.jar:4.12]
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.12.jar:4.12]
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.12.jar:4.12]
      	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) [junit-4.12.jar:4.12]
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20) [junit-4.12.jar:4.12]
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12]
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) [junit-4.12.jar:4.12]
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) [junit-4.12.jar:4.12]
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.12.jar:4.12]
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.12.jar:4.12]
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
      	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:275) [surefire-junit4-2.18.1.jar:2.18.1]
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173) [surefire-junit4-2.18.1.jar:2.18.1]
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:149) [surefire-junit4-2.18.1.jar:2.18.1]
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128) [surefire-junit4-2.18.1.jar:2.18.1]
      	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203) [surefire-booter-2.18.1.jar:2.18.1]
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155) [surefire-booter-2.18.1.jar:2.18.1]
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) [surefire-booter-2.18.1.jar:2.18.1]
      Caused by: java.lang.IllegalArgumentException: Unknown node id: 4 for node instance 1 for process instance WorkflowProcessInstance1 [processId=MultiInstance-1,state=1]
      	at org.jbpm.workflow.instance.impl.NodeInstanceImpl.getNode(NodeInstanceImpl.java:137) ~[jbpm-flow-7.8.0-SNAPSHOT.jar:7.8.0-SNAPSHOT]
      	at org.jbpm.workflow.instance.node.CompositeNodeInstance.getCompositeNode(CompositeNodeInstance.java:107) ~[jbpm-flow-7.8.0-SNAPSHOT.jar:7.8.0-SNAPSHOT]
      	at org.jbpm.workflow.instance.node.CompositeNodeInstance.getNodeContainer(CompositeNodeInstance.java:111) ~[jbpm-flow-7.8.0-SNAPSHOT.jar:7.8.0-SNAPSHOT]
      	at org.jbpm.workflow.instance.impl.NodeInstanceImpl.getNode(NodeInstanceImpl.java:133) ~[jbpm-flow-7.8.0-SNAPSHOT.jar:7.8.0-SNAPSHOT]
      	... 36 common frames omitted
      Caused by: java.lang.IllegalArgumentException: Unknown node id: 4
      	at org.jbpm.workflow.core.impl.NodeContainerImpl.getNode(NodeContainerImpl.java:61) ~[jbpm-flow-7.8.0-SNAPSHOT.jar:7.8.0-SNAPSHOT]
      	at org.jbpm.workflow.core.impl.WorkflowProcessImpl.getNode(WorkflowProcessImpl.java:53) ~[jbpm-flow-7.8.0-SNAPSHOT.jar:7.8.0-SNAPSHOT]
      	at org.jbpm.workflow.core.impl.WorkflowProcessImpl.internalGetNode(WorkflowProcessImpl.java:58) ~[jbpm-flow-7.8.0-SNAPSHOT.jar:7.8.0-SNAPSHOT]
      	at org.jbpm.workflow.instance.impl.NodeInstanceImpl.getNode(NodeInstanceImpl.java:133) ~[jbpm-flow-7.8.0-SNAPSHOT.jar:7.8.0-SNAPSHOT]
      	... 39 common frames omitted
      

      Analysis:
      ForEachNodeInstance is successfully migrated. But when migrating the next CompositeContextNodeInstance, CompositeContextNodeInstance.getNode() calls ForEachNodeInstance.getNode() internally. As ForEachNodeInstance.nodeId was already changed for the new process, it results in "Unknown node id".

      "((NodeInstanceImpl) nodeInstance).setNodeId(upgradedNodeId);" has to be delayed in MaigrationManager?

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  swiderski.maciej Maciej Swiderski
                  Reporter:
                  tkobayashi Toshiya Kobayashi
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: