Greetings,
I have a groovy inline script inside a Task Listener that is used to call a REST endpoint, which passes the taskId and formKey and a few other data points to said endpoint.
The script uses the wslite.RESTclient class (wslite.rest.RESTClient).
It works when executed locally using a Spring Boot setup, I have added the groovy-all and wslite dependencies in the pom.xml for my local spring boot installation.
Script for reference:
@Grab(group=‘org.codehaus.groovy.modules.http-builder’, module=‘http-builder’, version=‘0.7’ )
import wslite.rest.RESTClient import wslite.rest.RESTClientException def taskNames = task.getVariable('taskName') def taskURLs = task.getVariable('taskURL') def userIds = task.getVariable('varAssignedUser') def requestItems = task.getVariable('folio') RESTClient client = new RESTClient("${portalInstance}") def path = "endpoint/url" def response try { println(path) response = client.post(path: path) { type "ContentType.json" json taskName:taskNames, taskURL:taskURLs, userID:userIds, requestItem:requestItems } } catch (RESTClientException e) { return 500 }
However, when I try to execute the process on an Apache Tomcat installation on an ec2 instance, the task fails and closes the process. If the task is in the first executions, the process will not be initiated properly.
I have tried to add:
groovy-all-2.4.13.jar
groovy-3.0.11.jar
groovy-wslite-1.1.3.jar
To the apache-tomcat.x.x.x/lib/ folder.
According to the documentation simply putting the jar files in the folder should be enough, is that correct?
Or do I need to specify the wslite classes somewhere in the configuration file in /conf/bpm-platform.xml?