flowable / flowable-engine

A compact and highly efficient workflow and Business Process Management (BPM) platform for developers, system admins and business users.
https://www.flowable.org
Apache License 2.0
8.01k stars 2.63k forks source link

Missing Groovy engine in OSGi environment #3841

Closed karelmaxa closed 9 months ago

karelmaxa commented 9 months ago

Describe the bug

Using Groovy in OSGi environment throws FlowableException (Can't find scripting engine for 'groovy'). For example, the exception will be thrown when you use the following execution listener:

<flowable:executionListener event="start" class="org.flowable.engine.impl.bpmn.listener.ScriptExecutionListener">
    <flowable:field name="script">
        <flowable:string>execution.setVariable('foo', 'bar')</flowable:string>
    </flowable:field>
    <flowable:field name="language">
        <flowable:string>groovy></flowable:string>
    </flowable:field>
</flowable:executionListener>

Expected behavior

Groovy language can be used in OSGi environment.

Code

The Extender component tries to read the factory class from the first line of the corresponding Groovy configuration file (groovy-jsr223/javax.script.ScriptEngineFactory), but it is the license header.

https://github.com/flowable/flowable-engine/blob/356c0084c2c24e52f18bcac88e9e828f4b69ccae/modules/flowable-osgi/src/main/java/org/flowable/osgi/Extender.java#L371

Additional context

I'm using the following components:

I will try to submit a pull request with the fix.