javax.script.ScriptException: TypeError: Cannot call undefined in <eval> at line number 12263

GitHub | lordofthejars | 3 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Nashorn TypeError: Cannot call undefined in <eval>

    Stack Overflow | 2 years ago | Stradm
    javax.script.ScriptException: TypeError: Cannot call undefined in <eval> at line number 1
  2. 0

    Bluebird in JDK Nashorn

    GitHub | 2 years ago | akovari
    javax.script.ScriptException: TypeError: Cannot set property "Promise" of undefined in <eval> at line number 29
  3. 0

    GitHub comment 160#222550998

    GitHub | 9 months ago | MasseGuillaume
    javax.script.ScriptException: TypeError: Cannot read property "prototype" from undefined in <eval> at line number 465
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Cannot use standalone transformer in Java ScriptEngine

    GitHub | 2 years ago | jochenberger
    javax.script.ScriptException: TypeError: Cannot set property "coffeeReactTransform" of undefined in <eval> at line number 1
  6. 0

    FULL PRODUCT VERSION : java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b106) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b48, mixed mode) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows [Version 6.1.7601] A DESCRIPTION OF THE PROBLEM : New scripting engine introduced in Java 8 no longer seems to handle importClass or importPackage built-in functions. When referenced in a scripting, it throws javax.script.ScriptException: ReferenceError: "importClass" is not defined in <eval> at line number ... REGRESSION. Last worked in version 7u21 STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Run the source code specified in this bug report ERROR MESSAGES/STACK TRACES THAT OCCUR : SEVERE: null javax.script.ScriptException: ReferenceError: "importClass" is not defined in <eval> at line number 1 at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:553) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:537) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:517) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:513) at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:202) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at java8scripting.Java8Scripting.main(Java8Scripting.java:15) Caused by: <eval>:1 ReferenceError: "importClass" is not defined at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57) at jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:319) at jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:291) at jdk.nashorn.api.scripting.NashornScriptEngine.__noSuchProperty__(NashornScriptEngine.java:286) at jdk.nashorn.internal.scripts.Script$engine._L35(nashorn:engine/resources/engine.js:37) at jdk.nashorn.internal.scripts.Script$\^eval\_.runScript(<eval>:1) at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:527) at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:204) at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:395) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:535) ... 5 more REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- package java8scripting; import java.util.logging.Level; import java.util.logging.Logger; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; public class Java8Scripting { public static void main(String[] args) { try { ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("JavaScript") ; engine.eval("importClass(java.util.Vector) " + "print(\"Hello world\") ;"); } catch (Exception ex) { Logger.getLogger(Java8Scripting.class.getName()).log(Level.SEVERE, null, ex); } } } ---------- END SOURCE ----------

    JDK Bug System | 3 years ago | Nelson Dcosta
    javax.script.ScriptException: ReferenceError: "importClass" is not defined in <eval> at line number 1

  1. MrMonkey 1 times, last 10 months ago
4 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. javax.script.ScriptException

    TypeError: Cannot call undefined in <eval> at line number 12263

    at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException()
  2. jdk.nashorn.api
    NashornScriptEngine.eval
    1. jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:564)
    2. jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:548)
    3. jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:528)
    4. jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:524)
    5. jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:194)
    5 frames
  3. Unknown
    NashornTest.test2
    1. NashornTest.test2(NashornTest.java:67)
    1 frame
  4. Java RT
    DelegatingMethodAccessorImpl.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    3 frames
  5. JUnit
    JUnitCore.run
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    5. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    6. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    8. org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    9. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    10. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    11. org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    12. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    13. org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    14. org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    14 frames
  6. IntelliJ junit4 module
    JUnit4IdeaTestRunner.startRunnerWithArgs
    1. com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    1 frame
  7. IDEA
    JUnitStarter.main
    1. com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    2. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    2 frames
  8. Java RT
    NativeMethodAccessorImpl.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    2 frames
  9. IDEA
    AppMain.main
    1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
    1 frame