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

Coderanch | P Marksson | 7 months ago
  1. 0

    Nashorn help

    Coderanch | 7 months ago | P Marksson
    javax.script.ScriptException: TypeError: Cannot call undefined in <eval> at line number 73
  2. 0

    global-scope fields not accessible from within engine-scope methods

    Stack Overflow | 1 year ago | bvdb
    javax.script.ScriptException: ReferenceError: "wrapper" is not defined in <eval> at line number 7
  3. 0

    FULL PRODUCT VERSION : java version "1.8.0_77" Java(TM) SE Runtime Environment (build 1.8.0_77-b03) Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode) ADDITIONAL OS VERSION INFORMATION : Windows 8.1 pro - 64 Bit (Microsoft Windows [Version 6.3.9600]) A DESCRIPTION OF THE PROBLEM : i returned a java bean from an javascript called java function. on this returned object i called "Object.keys" and an TypeError will be thrown EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - In the log one row will be displayed before the exception was thown: bar ACTUAL - bar object ERROR MESSAGES/STACK TRACES THAT OCCUR : bar Exception in thread "main" javax.script.ScriptException: TypeError: Main$MyObject@a1153bc is not an Object in <eval> at line number 6 at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:467) at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:389) at jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:190) at Main.main(Main.java:92) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) Caused by: <eval>:6 TypeError: Main$MyObject@a1153bc is not an Object at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57) at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:213) at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:185) at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:172) at jdk.nashorn.internal.objects.NativeObject.notAnObject(NativeObject.java:136) at jdk.nashorn.internal.objects.NativeObject.keys(NativeObject.java:439) at jdk.nashorn.internal.scripts.Script$Recompilation$1$17$\^eval\_.main(<eval>:6) at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:640) at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:228) at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393) at jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:199) at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:383) ... 7 more Process finished with exit code 1 REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- Here is the Code: ==================== Java Start ==================== public class Main { public static void main(String [ ] args) throws ScriptException, NoSuchMethodException { ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn"); engine.eval(new BufferedReader(new InputStreamReader(Main.class.getResourceAsStream("/test.js")))); Invocable invocable = (Invocable) engine; invocable.invokeFunction("main"); } public static MyObject getMyObject() { return new MyObject("bar"); } public static class MyObject { private String foo; public MyObject(String foo) { this.foo = foo; } public String getFoo() { return foo; } } } ==================== Java End ===================== ============= JavaScript (test.js) Start ==================== function main () { var MyJavaClass = Java.type('Main'); var test = MyJavaClass.getMyObject(); print(test.foo); print(typeof Object.keys(test)); } ============= JavaScript (test.js) End ==================== ---------- END SOURCE ----------

    JDK Bug System | 9 months ago | Webbug Group
    javax.script.ScriptException: TypeError: Main$MyObject@a1153bc is not an Object in <eval> at line number 6
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    ariva.js

    GitHub | 2 months ago | littleyoda
    javax.script.ScriptException: TypeError: null has no such function "click" in <eval> at line number 76
  6. 0

    No such function __onCommand

    GitHub | 2 years ago | dzmartin
    javax.script.ScriptException: TypeError: Cannot read property "info" from undefined in <eval> at line number 70

    1 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 73

      at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException()
    2. jdk.nashorn.api
      NashornScriptEngine.invokeFunction
      1. jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:467)
      2. jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:389)
      3. jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:190)
      3 frames