no environment to get org.jbpm.pvm.internal.session.RepositorySession

我的代码是这样的:

public List<String> getAllOutgoingTransitionNamesByTaskId(String taskId) {
	Task task = taskService.getTask(taskId);
                ExecutionImpl execution = (ExecutionImpl) (this.executionService.findProcessInstanceById(task
		.getExecutionId()));
	ActivityImpl activity  = execution.getActivity();
	List<Transition> transitions = activity.getOutgoingTransitions();
	List<String> transitionNames = new ArrayList<String>();
	for(Transition transition:transitions){
		transitionNames.add(transition.getName());
	}
	return transitionNames;
}

 

报错信息:

org.jbpm.api.JbpmException: no environment to get org.jbpm.pvm.internal.session.RepositorySession
at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:197)
at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:190)
at org.jbpm.pvm.internal.model.ExecutionImpl.getProcessDefinition(ExecutionImpl.java:1120)
at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:411)
at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:402)

 
改正后:

public List<String> getAllOutgoingTransitionNamesByTaskId(String taskId) {
		List<String> transitionNames = new ArrayList<String>();
		transitionNames.addAll(taskService.getOutcomes(taskId));
		return transitionNames;
}

 

你可能感兴趣的:(java,jbpm)