cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot find scripting engine for 'groovy'

swamy2156
Champ on-the-rise
Champ on-the-rise
I am using Groovy script for my BPMN modal. I am getting the following exception though I was added dependency for groovy-all.jar in my pom. These are the dependencies added in my POM. Anyone has any idea why I am getting this exception thought I added dependencies which are required.

    <dependency>
     <groupId>org.codehaus.groovy</groupId>
     <artifactId>groovy-all</artifactId>
     <version>2.1.3</version>
   </dependency>
     <dependency>
        <groupId>asm</groupId>
        <artifactId>asm</artifactId>
        <version>3.2</version>
    </dependency>
   <dependency>
        <groupId>asm</groupId>
        <artifactId>asm-tree</artifactId>
        <version>3.2</version>
    </dependency>
   <dependency>
        <groupId>asm</groupId>
        <artifactId>asm-commons</artifactId>
        <version>3.2</version>
    </dependency>
    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm-util</artifactId>
        <version>3.2</version>
    </dependency>
    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm-analysis</artifactId>
        <version>3.2</version>
    </dependency>

But I am getting the following exception.
org.activiti.engine.ActivitiException: Can't find scripting engine for 'groovy'
   at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:71)
   at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:64)
   at org.activiti.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior.execute(ScriptTaskActivityBehavior.java:63)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:87)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:87)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:87)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:87)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:66)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:87)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:116)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:87)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:36)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:87)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:87)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:532)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:527)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:367)
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:105)
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:54)
   at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44)
   at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47)
   at org.activiti.engine.impl.bpmn.behavior.IntermediateCatchEventActivityBehavior.signal(IntermediateCatchEventActivityBehavior.java:27)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.signal(ExecutionEntity.java:350)
   at org.activiti.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler.execute(TimerCatchIntermediateEventJobHandler.java:45)
   at org.activiti.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:79)
   at org.activiti.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:62)
   at org.activiti.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:70)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:61)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37)
   at org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:46)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:619)
10 REPLIES 10

jbarrez
Star Contributor
Star Contributor
Could you try a more recent version? The latest seems to be 2.2.1

swamy2156
Champ on-the-rise
Champ on-the-rise
same issue even using with 2.2.1 version. Interesting thing is that, very occasionally groovy scripts are getting executed by groovy engine. For a fresh deployment of application, for first request, groovy gets executed. for subsequent requests having this issue.

regards,
Swamy.

trademak
Star Contributor
Star Contributor
It should work fine with 2.1.3. Can you create a unit test project showing your problem?

Thanks,

poseidonjm
Champ on-the-rise
Champ on-the-rise
Seems like activity 5.15 and 5.15.1 supports groovy up to 1.8.9

Maven dependencies:
<code>
<dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy</artifactId>
      <version>1.8.9</version>
    </dependency>
  
</code>
If you change to groovy 2.0.0 the test will fail
org.activiti.engine.ActivitiException: Can't find scripting engine for 'groovy'

Source code from Activiti in Action https://code.google.com/p/activitiinaction/downloads/list
<java>
public class RuntimeServiceTest {

private static RuntimeService runtimeService;

@BeforeClass
public static void init() {
  ProcessEngine processEngine = ProcessEngineConfiguration
   .createStandaloneInMemProcessEngineConfiguration()
    .buildProcessEngine();
 
  RepositoryService repositoryService = processEngine.getRepositoryService();
  repositoryService.createDeployment()
   .addClasspathResource("chapter4/bookorder.bpmn20.xml")
   .deploy();
 
  runtimeService = processEngine.getRuntimeService();
}

@Test
public void startProcessInstance() {
  Map<String, Object> variableMap = new HashMap<String, Object>();
  variableMap.put("isbn", "123456");
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("bookorder", variableMap);
  assertNotNull(processInstance.getId());
  System.out.println("id " + processInstance.getId() + " "
    + processInstance.getProcessDefinitionId());
}
 
}
</java>

trademak
Star Contributor
Star Contributor
Okay, could you raise a JIRA for this?

Thanks,

poseidonjm
Champ on-the-rise
Champ on-the-rise

poseidonjm
Champ on-the-rise
Champ on-the-rise
As Joram Barrez says
https://jira.codehaus.org/browse/ACT-1984

the solutions is change groovy to groovy-all
issue resolved
<code>
<dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <version>2.2.2</version>
    </dependency>
</code>

ndup0nt
Champ in-the-making
Champ in-the-making
Same exception (org.activiti.engine.ActivitiException: Can't find scripting engine for 'groovy') still occurs (randomly ?) in Activiti 5.17. Seems to happen with the first instance only of a process.

jbarrez
Star Contributor
Star Contributor
That seems odd. You sure you have groovy-all on the classpath?
Do you have an example of a process where it fails?