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

error Nashorn AST Serializer (36) NoClassDefFoundError: java/uti|/function/Function

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.8.0_131"
      Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 64-Bit (7601)

      A DESCRIPTION OF THE PROBLEM :
      This is an upstream bug report for https://josm.openstreetmap.de/ticket/14905

      As per Quality Outreach please add label "josm-found" to this report.

      One of our users face the following error when initializing Nashorn:

      Thread: Nashorn AST Serializer (36)
      java.lang.NoClassDefFoundError: java/uti|/function/Function
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
      at java.lang.Class.getDeclaredMethod(Unknown Source)
      at java.io.ObjectStreamClass.getPrivateMethod(Unknown Source)
      at java.io.ObjectStreamClass.access$1700(Unknown Source)
      at java.io.ObjectStreamClass$2.run(Unknown Source)
      at java.io.ObjectStreamClass$2.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.io.ObjectStreamClass.<init>(Unknown Source)
      at java.io.ObjectStreamClass.lookup(Unknown Source)
      at java.io.ObjectOutputStream.writeObject0(Unknown Source)
      at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
      at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
      at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
      at java.io.ObjectOutputStream.writeObject0(Unknown Source)
      at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
      at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
      at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
      at java.io.ObjectOutputStream.writeObject0(Unknown Source)
      at java.io.ObjectOutputStream.writeObject(Unknown Source)
      at jdk.nashorn.internal.runtime.AstSerializer.serialize(AstSerializer.java:47)
      at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData$SerializedAst.<init>(RecompilableScriptFunctionData.java:504)
      at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData$1.run(RecompilableScriptFunctionData.java:461)

      The Javascript code given to Nashorn can be found here:
      https://josm.openstreetmap.de/export/11595/josm/trunk/data/validator/opening_hours.js

      The code loading this script with Nashorn is as follows:

      ScriptEngine ENGINE = new ScriptEngineManager().getEngineByName("JavaScript");

                  try (CachedFile cf = new CachedFile("resource://data/validator/opening_hours.js");
                       Reader reader = cf.getContentReader()) {
                      ENGINE.eval(reader);
                      ENGINE.eval("var opening_hours = require('opening_hours');");
                      // fake country/state to not get errors on holidays
                      ENGINE.eval("var nominatimJSON = {address: {state: 'Bayern', country_code: 'de'}};");
                      ENGINE.eval(
                              "var oh = function (value, mode, locale) {" +
                              " try {" +
                              " var r = new opening_hours(value, nominatimJSON, {mode: mode, locale: locale});" +
                              " r.getErrors = function() {return [];};" +
                              " return r;" +
                              " } catch (err) {" +
                              " return {" +
                              " prettifyValue: function() {return null;}," +
                              " getWarnings: function() {return [];}," +
                              " getErrors: function() {return [err.toString()]}" +
                              " };" +
                              " }" +
                              "};");
                  }

      This code has not changed in the past 3 months and we have thousands of users who didn't face this error before, so we assume it's a recent regression (8u131 maybe?) that involves non-deterministic behaviour.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Thread: main-init-1 (27)
      java.util.zip.ZipFile.read(Native Method)
      java.util.zip.ZipFile.access$1400(Unknown Source)
      java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source)
      java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(Unknown Source)
      java.util.zip.InflaterInputStream.read(Unknown Source)
      sun.misc.Resource.getBytes(Unknown Source)
      java.net.URLClassLoader.defineClass(Unknown Source)
      java.net.URLClassLoader.access$100(Unknown Source)
      java.net.URLClassLoader$1.run(Unknown Source)
      java.net.URLClassLoader$1.run(Unknown Source)
      java.security.AccessController.doPrivileged(Native Method)
      java.net.URLClassLoader.findClass(Unknown Source)
      java.lang.ClassLoader.loadClass(Unknown Source)
      java.lang.ClassLoader.loadClass(Unknown Source)
      jdk.nashorn.internal.codegen.CodeGenerator.emitObjectToNumberComparisonConversion(CodeGenerator.java:721)
      jdk.nashorn.internal.codegen.CodeGenerator.loadComparisonOperands(CodeGenerator.java:700)
      jdk.nashorn.internal.codegen.BranchOptimizer.branchOptimizer(BranchOptimizer.java:125)
      jdk.nashorn.internal.codegen.BranchOptimizer.branchOptimizer(BranchOptimizer.java:153)
      jdk.nashorn.internal.codegen.BranchOptimizer.execute(BranchOptimizer.java:57)
      jdk.nashorn.internal.codegen.CodeGenerator.emitBranch(CodeGenerator.java:2206)
      jdk.nashorn.internal.codegen.CodeGenerator.enterForOrWhile(CodeGenerator.java:3425)
      jdk.nashorn.internal.codegen.CodeGenerator.enterForNode(CodeGenerator.java:1751)
      jdk.nashorn.internal.ir.ForNode.accept(ForNode.java:93)
      jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
      jdk.nashorn.internal.ir.LexicalContextStatement.accept(LexicalContextStatement.java:55)
      jdk.nashorn.internal.ir.LoopNode.accept(LoopNode.java:36)
      jdk.nashorn.internal.ir.Node.accept(Node.java:271)
      jdk.nashorn.internal.ir.Block.accept(Block.java:185)
      jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
      jdk.nashorn.internal.ir.Block.accept(Block.java:439)
      jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:336)
      jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
      jdk.nashorn.internal.ir.LexicalContextExpression.accept(LexicalContextExpression.java:47)
      jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:55)
      jdk.nashorn.internal.codegen.CompilationPhase.transformFunction(CompilationPhase.java:628)
      jdk.nashorn.internal.codegen.CompilationPhase.access$100(CompilationPhase.java:55)
      jdk.nashorn.internal.codegen.CompilationPhase$BytecodeGenerationPhase.transform(CompilationPhase.java:418)
      jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:624)
      jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:655)
      jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.compileTypeSpecialization(RecompilableScriptFunctionData.java:725)
      jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.getBest(RecompilableScriptFunctionData.java:905)
      jdk.nashorn.internal.runtime.ScriptFunctionData.getBest(ScriptFunctionData.java:375)
      jdk.nashorn.internal.runtime.ScriptFunctionData.getBestInvoker(ScriptFunctionData.java:237)
      jdk.nashorn.internal.runtime.ScriptFunction.findCallMethod(ScriptFunction.java:871)
      jdk.nashorn.internal.runtime.ScriptObject.lookup(ScriptObject.java:1825)
      jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:104)
      jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:98)
      jdk.internal.dynalink.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(CompositeTypeBasedGuardingDynamicLinker.java:176)
      jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124)
      jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:154)
      jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:253)
      java.lang.invoke.LambdaForm$DMH/28215853.invokeSpecial_LLIL_L(LambdaForm$DMH)
      java.lang.invoke.LambdaForm$BMH/16067693.reinvoke(LambdaForm$BMH)
      java.lang.invoke.LambdaForm$MH/14173807.exactInvoker(LambdaForm$MH)
      java.lang.invoke.LambdaForm$MH/16450363.linkToCallSite(LambdaForm$MH)
      jdk.nashorn.internal.scripts.Script$1$\^eval\_.:program(<eval>:1)
      java.lang.invoke.LambdaForm$DMH/7468253.invokeStatic_LL_L(LambdaForm$DMH)
      java.lang.invoke.LambdaForm$MH/30350019.invokeExact_MT(LambdaForm$MH)
      jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
      jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
      jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
      jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:449)
      jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
      jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
      jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:150)
      javax.script.AbstractScriptEngine.eval(Unknown Source)
      org.openstreetmap.josm.data.validation.tests.OpeningHourTest.initialize(OpeningHourTest.java:54)
      org.openstreetmap.josm.data.validation.tests.ConditionalKeys.initialize(ConditionalKeys.java:50)
      org.openstreetmap.josm.data.validation.OsmValidator.initializeTests(OsmValidator.java:353)
      org.openstreetmap.josm.data.validation.OsmValidator.initializeTests(OsmValidator.java:336)
      org.openstreetmap.josm.Main$$Lambda$135/24382894.run(Unknown Source)
      java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      java.util.concurrent.FutureTask.run(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      java.lang.Thread.run(Unknown Source)

      Thread: main-init-0 (26)
      java.util.zip.ZipFile.getEntry(Unknown Source)
      java.util.jar.JarFile.getEntry(Unknown Source)
      java.util.jar.JarFile.getJarEntry(Unknown Source)
      sun.misc.URLClassPath$JarLoader.getResource(Unknown Source)
      sun.misc.URLClassPath.getResource(Unknown Source)
      java.net.URLClassLoader$1.run(Unknown Source)
      java.net.URLClassLoader$1.run(Unknown Source)
      java.security.AccessController.doPrivileged(Native Method)
      java.net.URLClassLoader.findClass(Unknown Source)
      java.lang.ClassLoader.loadClass(Unknown Source)
      java.lang.ClassLoader.loadClass(Unknown Source)
      jdk.internal.dynalink.support.ClassMap.get(ClassMap.java:153)
      jdk.internal.dynalink.support.TypeConverterFactory.getCacheableTypeConverter(TypeConverterFactory.java:356)
      jdk.internal.dynalink.support.TypeConverterFactory.getCacheableTypeConverterNull(TypeConverterFactory.java:343)
      jdk.internal.dynalink.support.TypeConverterFactory.getTypeConverterNull(TypeConverterFactory.java:349)
      jdk.internal.dynalink.support.TypeConverterFactory.asType(TypeConverterFactory.java:246)
      jdk.internal.dynalink.support.LinkerServicesImpl.asType(LinkerServicesImpl.java:131)
      jdk.internal.dynalink.linker.LinkerServices$Implementation.asTypeLosslessReturn(LinkerServices.java:206)
      jdk.internal.dynalink.support.LinkerServicesImpl.asTypeLosslessReturn(LinkerServicesImpl.java:136)
      jdk.internal.dynalink.linker.GuardedInvocation.asTypeSafeReturn(GuardedInvocation.java:339)
      jdk.nashorn.internal.runtime.linker.Bootstrap.asTypeSafeReturn(Bootstrap.java:439)
      jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:98)
      jdk.internal.dynalink.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(CompositeTypeBasedGuardingDynamicLinker.java:176)
      jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124)
      jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:154)
      jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:253)
      java.lang.invoke.LambdaForm$DMH/28215853.invokeSpecial_LLIL_L(LambdaForm$DMH)
      java.lang.invoke.LambdaForm$BMH/5346524.reinvoke(LambdaForm$BMH)
      java.lang.invoke.LambdaForm$MH/5825900.exactInvoker(LambdaForm$MH)
      java.lang.invoke.LambdaForm$MH/8532120.linkToCallSite(LambdaForm$MH)
      jdk.nashorn.internal.scripts.Script$3$\^eval\_.:program(<eval>:1)
      java.lang.invoke.LambdaForm$DMH/16284740.invokeStatic_LL_I(LambdaForm$DMH)
      java.lang.invoke.LambdaForm$BMH/32216253.reinvoke(LambdaForm$BMH)
      java.lang.invoke.LambdaForm$MH/30350019.invokeExact_MT(LambdaForm$MH)
      jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
      jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
      jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
      jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:449)
      jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
      jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
      jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:150)
      javax.script.AbstractScriptEngine.eval(Unknown Source)
      org.openstreetmap.josm.tools.OverpassTurboQueryWizard.<init>(OverpassTurboQueryWizard.java:47)
      org.openstreetmap.josm.tools.OverpassTurboQueryWizard.getInstance(OverpassTurboQueryWizard.java:34)
      org.openstreetmap.josm.Main$$Lambda$136/6987850.call(Unknown Source)
      java.util.concurrent.FutureTask.run(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      java.lang.Thread.run(Unknown Source)

      REPRODUCIBILITY :
      This bug can be reproduced rarely.

            jlaskey Jim Laskey
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: