Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[transform.javascript] Nashorn dependency is unavailable since Java 15 #12359

Closed
wborn opened this issue Feb 23, 2022 · 3 comments
Closed

[transform.javascript] Nashorn dependency is unavailable since Java 15 #12359

wborn opened this issue Feb 23, 2022 · 3 comments
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@wborn
Copy link
Member

wborn commented Feb 23, 2022

While getting the add-ons build to work with Java 17 in #12353, I noticed that the JavaScript Transformation add-on depends on the Nashorn JavaScript engine which has been removed from Java since Java 15.

Expected Behavior

The add-on works on Java 17 and later.

Current Behavior

It will try to get a "javascript" ScriptEngine but this will fail because it is no longer provided by the JVM.

Possible Solution

The easiest way would be to embed and use the nashorn dependency in the bundle.
It could also be rewritten to use GraalVM.
It might also be an idea to create an add-on (or core service) supporting transformations using any of the installed/available scripting engines.

Steps to Reproduce (for Bugs)

  1. Try using the add-on with Java 17. 🙂

Your Environment

  • openHAB 3.3.0-SNAPSHOT
  • OpenJDK Runtime Environment Zulu17.32+13-CA (build 17.0.2+8-LTS)
  • Ubuntu 20.04.4 LTS
@wborn wborn added the bug An unexpected problem or unintended behavior of an add-on label Feb 23, 2022
@J-N-K
Copy link
Member

J-N-K commented Feb 23, 2022

IMO your last suggestion would be the best one.

@wborn
Copy link
Member Author

wborn commented Feb 23, 2022

Yes if that works out well it would provide a lot of functionality and reduce the number of add-ons we have to maintain/install. 🙂

I also did some testing with creating a Nashorn based JS scripting engine automation add-on for backwards compatibility on Java 17. The issues I ran into are probably fixed now with openhab/openhab-core#2787. But it could become very confusing if there are 2 JavaScript automation add-ons (and still Nashorn on Java 11).

@wborn
Copy link
Member Author

wborn commented Apr 24, 2022

Let's close this now the core has a generic script transformation with openhab/openhab-core#2883 which can be used with any scripting engine.

I also did some testing with creating a Nashorn based JS scripting engine automation add-on for backwards compatibility on Java 17.

This can now be used by installing the JSScripting (Nashorn) add-on available in the Marketplace.

@wborn wborn closed this as completed Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

No branches or pull requests

2 participants