AnsweredAssumed Answered

what's problem with my code

Question asked by yz_ellen on Jul 8, 2011
Latest reply on Aug 24, 2012 by rs-activiti
the code is wrong ,how I can solve , this my code  intend to jump to any node(usertask).    


  ProcessDefinitionEntity def = (ProcessDefinitionEntity)        ((RepositoryServiceImpl)repositoryService).getDeployedProcessDefinition("mutitask:17:5704");
      ActivityImpl source = null;
      ActivityImpl destination = null;
      
   
       Execution execution = (Execution) runtimeService.createExecutionQuery()
          .executionId("6501")
          .singleResult();
      
      String activitiId = ((ExecutionEntity) execution).getActivityId();
        ScopeImpl scopeImpl=def;
            ActivityImpl  des=null;
       ActivityImpl  source=null;
       source= scopeImpl.findActivity("usertask2");
       des=scopeImpl.findActivity("usertask1");
      
      Map<String, Object> vals = new HashMap<String, Object>();
      vals.put("isInvolve", true);
      
      TransitionImpl transition = new TransitionImpl("mytransition", def);
      //TransitionImpl transition=source.createOutgoingTransition();
      
      // transition.setProperties(vals);
      transition.setSource(source);
      transition.setDestination(destination);
      
      System.out.println(transition);
      System.out.println(source.getOutgoingTransitions());
      
      ExecutionEntity execution2 = (ExecutionEntity) runtimeService.createExecutionQuery().executionId("6501").singleResult();
      
      // taskService.complete("10", vals);
      try {
         execution2.take(transition);
         
      } catch (Exception e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
             
        
             error message :
java.lang.NullPointerException
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:326)
   at com.zfsoft.workflow.test.activiti.TestRuntimeService.testTranaction(TestRuntimeService.java:200)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
   at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
   at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
   at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
   at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
   at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
   at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



  thank you

Outcomes