Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8274778

Could not initialize class org.openjdk.nashorn.internal.runtime.Context$Anonymou

    XMLWordPrintable

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      openjdk version "17" 2021-09-14 LTS
      OpenJDK Runtime Environment SapMachine (build 17+35-LTS-sapmachine)
      OpenJDK 64-Bit Server VM SapMachine (build 17+35-LTS-sapmachine, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      he JavaScript enginge initialized good… but later during validating/executing specific JS script fails:
      java.lang.NoClassDefFoundError: Could not initialize class org.openjdk.nashorn.internal.runtime.Context$AnonymousContextCodeInstaller
            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 com.sap.platin.base.scripting.javaScript.GuiJavaScriptInterpreter.hasEventHandler(GuiJavaScriptInterpreter.java:133)
            at com.sap.platin.base.scripting.javaScript.GuiJavaScriptEventHandler.hasEventHandler(GuiJavaScriptEventHandler.java:162)
            at com.sap.platin.base.scripting.javaScript.GuiScriptWindow.<init>(GuiScriptWindow.java:193)
            at com.sap.platin.base.scripting.javaScript.GuiJavaScriptEventHandler.openScriptWindow(GuiJavaScriptEventHandler.java:294)

      MAIN REASON -> limitation access to internal classes in JDK 17:
      Related to JDK17 & new standalone JS Engine:
      Main reason limitation in JDK17 with access to internal “deprecated” classes:
      Caused by: java.lang.NoSuchMethodError: 'java.lang.Class sun.misc.Unsafe.defineAnonymousClass(java.lang.Class, byte[], java.lang.Object[])'

      REGRESSION : Last worked in version 16.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Any small application with Java + Nashorn...

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Should be executed JavaScript code without issues
      ACTUAL -
      Related to JDK17 & new standalone JS Engine (Nashorn standalone 15.3):
      Main reason limitation in JDK17 with access to internal “deprecated” classes:
      Caused by: java.lang.NoSuchMethodError: 'java.lang.Class sun.misc.Unsafe.defineAnonymousClass(java.lang.Class, byte[], java.lang.Object[])'

      CUSTOMER SUBMITTED WORKAROUND :
      Not exist on Java 17.

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            tongwan Andrew Wang
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: