Does Nashorn (org.openjdk.nashorn) have any support for Java 17?

Greg Watts gwatts at us.ibm.com
Mon Jun 28 16:24:36 UTC 2021


Dear Nashorn development team,

I am trying to run an ANT build of our product using
nashorn-core:15.1.1.jar with Java 17 (pre-release - build 27) and I get:

BUILD FAILED
java.lang.ExceptionInInitializerError
    at
org.openjdk.nashorn.internal.runtime.Context.compile(Context.java:1509)
    at
org.openjdk.nashorn.internal.runtime.Context.compileScript(Context.java:1449)
    at
org.openjdk.nashorn.internal.runtime.Context.compileScript(Context.java:759)
    at
org.openjdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:528)
    at
org.openjdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:517)
    at
org.openjdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:395)
    at
org.openjdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:151)
    at
java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:262)
    at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
    at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.apache.tools.ant.util.ReflectUtil.invoke(ReflectUtil.java:108)
    at
org.apache.tools.ant.util.ReflectWrapper.invoke(ReflectWrapper.java:81)
    at
org.apache.tools.ant.util.optional.JavaxScriptRunner.evaluateScript(JavaxScriptRunner.java:103)
    at
org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript(JavaxScriptRunner.java:67)
    at
org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:52)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:392)
    at org.apache.tools.ant.Target.performTasks(Target.java:413)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    at org.apache.tools.ant.Main.runBuild(Main.java:811)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: no
such method:
sun.misc.Unsafe.defineAnonymousClass(Class,byte[],Object[])Class/invokeVirtual
    at org.openjdk.nashorn.internal.runtime.Context
$AnonymousContextCodeInstaller.lambda$getDefineAnonymousClass
$0(Context.java:335)
    at
java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at org.openjdk.nashorn.internal.runtime.Context
$AnonymousContextCodeInstaller.getDefineAnonymousClass(Context.java:327)
    at org.openjdk.nashorn.internal.runtime.Context
$AnonymousContextCodeInstaller.<clinit>(Context.java:317)
    ... 33 more
Caused by: java.lang.NoSuchMethodException: no such method:
sun.misc.Unsafe.defineAnonymousClass(Class,byte[],Object[])Class/invokeVirtual
    at
java.base/java.lang.invoke.MemberName.makeAccessException(MemberName.java:976)
    at java.base/java.lang.invoke.MemberName
$Factory.resolveOrFail(MemberName.java:1117)
    at java.base/java.lang.invoke.MethodHandles
$Lookup.resolveOrFail(MethodHandles.java:3643)
    at java.base/java.lang.invoke.MethodHandles
$Lookup.findVirtual(MethodHandles.java:2680)
    at org.openjdk.nashorn.internal.runtime.Context
$AnonymousContextCodeInstaller.lambda$getDefineAnonymousClass
$0(Context.java:329)
    ... 36 more
Caused by: java.lang.NoSuchMethodError: 'java.lang.Class
sun.misc.Unsafe.defineAnonymousClass(java.lang.Class, byte[],
java.lang.Object[])'
    at java.base/java.lang.invoke.MethodHandleNatives.resolve(Native
Method)
    at java.base/java.lang.invoke.MemberName
$Factory.resolve(MemberName.java:1085)
    at java.base/java.lang.invoke.MemberName
$Factory.resolveOrFail(MemberName.java:1114)
    ... 39 more


So I was curious to know please if Nashorn will be supported in Java 17,
and if so, when you might anticipate that to be released (ballpark
estimate)?


Greg Watts
WebSphere Zombie Apocalypse Team
External: 507-253-8901
email: gwatts at us.ibm.com

"Take risks:  if you win, you will be happy; if you lose, you will be wise"
- Unknown


More information about the nashorn-dev mailing list