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

Fixing error due to null Nashorn engine #28

Merged

Conversation

antoniogarrote
Copy link
Contributor

@antoniogarrote antoniogarrote commented Sep 27, 2017

I came across this problem running the library from Scala SBT.

The validator was failing with a null pointer exception. Looking at the source of the error the cause was that nashorn was not being found.

The actual problem seems to be that Scala REPL is doing something to the ScriptEngine factories.
The following code:

val sm = new javax.script.ScriptEngineManager
println("ENGINES:")
sm.getEngineFactories.forEach(ef => println(ef.getEngineName))

Produces the following output where nashorn is missing:

ENGINES:
Scala REPL

I have been unable to reproduce the error in other JVM based language REPLs (tried JRuby and Kotlin) but even if the issue is Scala specific, the problem can be easily solved by looking in the standard factories, passing a null parameter to the constructor if the standard mechanism fails.

@HolgerKnublauch HolgerKnublauch merged commit da088b6 into TopQuadrant:master Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants