java.lang.Error: Maximum variableScope time of 3000 ms exceeded
解决方法:
@Component
public class ActivitiConfig implements ProcessEngineConfigurationConfigurer {
@Override
public void configure(SpringProcessEngineConfiguration
processEngineConfiguration) {
SecureJavascriptConfigurator configurator = new SecureJavascriptConfigurator()
.setEnableClassWhiteListing(true)
.setWhiteListedClasses(new HashSet<String>(Arrays.asList("com.plancode.MyBean")))
.setMaxStackDepth(10)
.setMaxScriptExecutionTime(3000L)
.setMaxMemoryUsed(1024*1024L)
.setNrOfInstructionsBeforeStateCheckCallback(10);
processEngineConfiguration.addConfigurator(configurator);
}
}
报错是因为代码运行的时间过长,超过了MaxScriptExecutionTime允许脚本运行的最长时间。