Previous Topic

Next Topic

Book Contents

Book Index

Module Description

The aim of the Scripting module is to simplify the use of scripting languages in OSGi environment. It provides unified access to installed scripting engines (conforming to JSR 223 specification), and a set of helper objects (for working with OSGi, Functional Item Management, etc.) available as variables to all scripts.

Feature Set

The module provides the following features:

Known Issues and Limitations

Nashorn JavaScript engine is no longer available as of JDK 15. The recommended replacement is GraalJS. For more information refer to the Migration guide provided.

Insufficient Script Permissions

Prior to version 1.8.0_112 of Nashorn the executed script is not granted the full permissions of the caller of the ScriptEngine.eval(...) method, which can lead to Security Exceptions from scripts when Java is running with Security Manager enabled. To alleviate this issue the latest Nashorn/JRE version should be used.

Nashorn URLReader Does Not Close Stream Properly

There is a synchronization issue in Nashorn URLReader (JDK-8174147 bug) as of version 1.8.0_121, which leaves the underlying input stream open after the reader is closed. As a result, script files executed using the OSGiScriptEngine.eval(java.net.URL...) methods can sometimes remain locked until after the executing JVM is stopped.

Incorrect Handling of Enum Return Types

In some version of Java 9, Nashorn does not handle correctly enum return types in interface implementations – see JDK-8191882 bug. As a result, WrongMethodTypeException is thrown when attempting to call such methods.

Nashorn Leaks Memory When Generating Interface Implementations

Nashorn leaks memory when generating interface implementations with different class-loaders – see JDK-8198540 bug. In OSGi environment, bundles get a new class-loader when updated, so this bug results in memory leaked when bundles, generating interface implementations from JavaScript objects, get updated. These might be bundles which, for example, use Registry Access or FIM Access to register OSGi services or Functional Items from JavaScript.

Module Dependencies

The Scripting module depends on:

Licensing Information

No Licensing Information is available for this module.