1.1.7
Upgrading and Migrating Scripting Module to Version 2.0 - Mule 4
Upgrade Anypoint Connector for Scripting module (Scripting module) to version 2.0.0.
Changes in This Release
This release contains the following changes:
-
Because the Scripting module no longer provides default scripting engines, perform one of the following actions:
-
Use the Configure… button to install your desired engines.
-
Specify desired engines in the
pom.xml
file of your application.
-
-
For any data stream provided in the payload or variables, a cursor object opens and binds so that you need not open new cursors.
AnyopenCursor()
provided to the Scripting module closes after the script execution.
Upgrade Prerequisites
Before you perform the upgrade, you must create a backup of your files, data, and configurations in case you need to restore to them.
Upgrade Steps
Follow these steps to perform the upgrade:
-
In Anypoint Studio, create a Mule project.
-
In Mule Palette, click Search in Exchange.
-
In Add Dependencies to Project, enter
scripting module
in the search field. -
In Available modules, select
Scripting module
and click Add. -
Click Finish.
-
Verify that the
mule-scripting-module
dependency version is2.0.0
in the Mule project file.
Studio upgrades the connector version automatically.
Post-Upgrade Steps
After you install the latest version of the connector, add a jsr-223
-compliant scripting engine:
-
In Anypoint Studio, navigate to the Execute tab operation of your application.
-
Use one of the following two options to install and configure a
jsr-223
-compliant engine:-
In the Required Libraries section, click Configure… and select one of the following options to search and install the engine:
-
Add recommended libraries
Install Groovy engine as recommended. This option appears only if you did not previously install Groovy. -
Use local file
Browse a local file for the required engine library and install it. -
Add Maven dependency
Browse the engine dependency and install it.
-
-
In the
pom.xml
file, manually add the engine in both of these sections:-
<sharedLibraries>
tags under the<configuration>
section -
<dependency>
tags under the<dependencies>
section
-
-
-
In the General section of the Execute tab, click the refresh button to update the engine values list for the operation.
-
In Engine, select the installed engine.
Troubleshooting
-
Engine names inconsistency
When you see different engine names in the Studio configuration tab and Configuration XML tab, engine names display differently than in previous Scripting module versions. This occurs because the engine company defines and provides an identifier for both the engine and language name, for example:
Engine Name | Studio Configuration | Configuration XML |
---|---|---|
Jython |
Jython |
Python |
Groovy |
Groovy Scripting Engine |
Groovy |
Nashorn (JavaScript) |
Oracle Nashorn |
ECMASCript |
-
Jython engine
When you use a Jython engine that’s not a standalone version in Scripting module v2.0, cause the application to fail. Previous Scripting module versions worked with Jython engines that were not standalone versions. Usejython-standalone
version for Scripting module v2.0. For additional information, see Scripting Module XML and Maven Support. -
Oracle Nashorn engine
If you see Oracle Nashorn (ECMASCript) engine as an available option to select in the Studio configuration tab without the necessity to install or configure it, this indicates that some versions of JVM (Java Virtual Machine) previously installed and use the engine.
Reverting the Upgrade
If you need to revert to the previous version of Scripting module, go to Anypoint Studio and do the following:
-
In the project’s
pom.xml
file, change themule-scripting-module
dependency version2.0.0
to the previous version, and delete the engine dependency used from the<dependencies>
section. -
Return to the Execute tab, and in the Engine section, select one of the default engines.
-
In the Configuration XML tab, confirm the selected engine name also changed.