How to use BPMN 2.0 ScriptTask with Groovy in JBoss

Note: this blogpost only applies to camunda BPM version  < 7.1.0. Starting from camunda BPM 7.2.0 we ship Groovy as part of the pre-packaged distribution.

Recently at a customer we added a ScriptTask to a process and wanted to run a Groovy script. Pretty easy with camunda BPM – but in the JBoss environment you have to know how to correctly put Groovy on the classpath – as we correctly use the JSR 223 stuff to recognize existing Scripting Languages.
Adding a scriptTask to a process to run a Groovy script

To help others and to remind myself I quickly wanted to blog how to do this.

1.) Add groovy module to your JBoss

Download latest groovy-all.jar and copy it to JBOSS_HOME/modules/groovy/main/groovy-all.jar.
Create JBOSS_HOME/modules/groovy/main/module.xml with the following content:

<?xml version="1.0"
encoding="UTF-8"?>
<module
xmlns="urn:jboss:module:1.0" name="groovy">
    <resources>
       
<resource-root path="groovy-all.jar"/>
   
</resources>
       
   
<dependencies>
       
<module name="javax.api"/>
       
<module name="org.apache.commons.logging"/>
   
</dependencies>
</module>
 

2.) Add dependency to groovy in the camunda engine module

Edit file  JBOSS_HOME/modules/org/camunda/bpm/camunda-engine/main/module.xml. Add one line in the dependencies:

 <module name="groovy"
services="import" export="true" />
Important is the services=”import” which tells JBoss to recognize the META-INF/services directory in groovy – which is does not by default. This is the small thing with normally takes some hours to solve – hope this helps somebody out there. The whole module.xml now looks more or less like this:

<module xmlns="urn:jboss:module:1.0" name="org.camunda.bpm.camunda-engine">
 <resources>
  <resource-root path="camunda-engine-7.0.0-Final.jar" />
 </resources>

 <dependencies>
  <module name="javax.api" />
  <module name="javax.transaction.api"/>
  <module name="javax.enterprise.api" />
  <module name="javax.inject.api" />
  <module name="javax.ejb.api" />
  <module name="javax.xml.bind.api" />
  <module name="javax.servlet.api" />
 
  <module name="org.jboss.vfs" />
  <module name="org.mybatis.mybatis" />
  <module name="com.fasterxml.uuid.java-uuid-generator"/>
  <module name="org.joda.time" slot="2.1" />    
 
  <b><module name="groovy" services="import" export="true" /></b>  
 </dependencies>

</module>

3.) Have fun with the ScriptTask!

  • Monitoring Camunda Platform 7 with Prometheus

    Monitoring is an essential facet of running applications in a production system. Through this process, organizations collect and analyze data, and determine if a program is performing as expected within set boundaries. When combined with alerting, monitoring allows for detecting unexpected system behavior to mitigate exceptional situations as fast as possible. Furthermore, tracking the performance of a system enables organizations to improve those aspects that have the biggest impact with higher priority. One essential aspect of monitoring is the list of key metrics you want to observe. There are different categories of statistics that can be of interest here. To observe the defined metrics, there are plenty of application monitoring tools on the market today. They differ in many aspects...

    Read more
  • Securing Camunda 8 self-managed cluster and applications...

    Directory services are an effective way to manage an organization’s users, groups, printers, devices, and more. Most organizations accomplish this using Active Directory, Apache Directory, Oracle Internet Directory, or other similar tools. Recently I worked with a customer who wanted to see how he could secure the Camunda 8 Platform and process applications with such a directory. Their requirements consisted of: Allowing Directory users to access Camunda applications (Tasklist, Operate, Optimize) Accessing secured Tasklist & Operate APIs from our custom project Securing the custom project In this article, I’ll briefly explain the 3 easy steps taken to fulfill their requirements which include: Federate users from the Directory service into Keycloak Declare an application in Identity to access Camunda APIs Configure...

    Read more
  • Accelerate Connectivity with Camunda Platform 8.1

    We’re thrilled to announce Camunda Platform 8.1, the latest release of our process orchestration solution. This new version introduces features that accelerate connectivity to the many different systems and technologies that are required for true digital transformation, including: Create custom Connectors with our Integration Framework to accelerate connectivity New out-of-the-box Connectors for popular services Enhancements to Camunda Modeler that improve productivity Hot backups and official support for Amazon EKS and Red Hat OpenShift Plus, several upgrades requested by Camunda Platform 7 customers Organizations across all industries rely on complex technology stacks to adapt and enhance their operations in response to market dynamics, new disruptive companies, and increasing consumer expectations. Your technology stack likely includes everything from cutting-edge technologies to legacy...

    Read more

Ready to get started?

Still have questions?