You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have upgraded to project to Java 11 (and the graal version from 20.1.0 above to 22.0.0) and am now getting the following error:
Caused by: org.graalvm.polyglot.PolyglotException: TypeError: (intermediate value).entries is not a function
at <js>.convertProperties (esMappingsPlus.js:1526)
at <js>.:program (esMappingsPlus.js:1599)
at org.graalvm.polyglot.Context.eval (Context.java:399)
at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval (GraalJSScriptEngine.java:458)
at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval (GraalJSScriptEngine.java:400)
at javax.script.AbstractScriptEngine.eval (AbstractScriptEngine.java:249)
at io.github.yas99en.mojo.script.ExecuteMojo.evalScriptFile (ExecuteMojo.java:171)
at io.github.yas99en.mojo.script.ExecuteMojo.evaluate (ExecuteMojo.java:110)
at io.github.yas99en.mojo.script.ExecuteMojo.execute (ExecuteMojo.java:75)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
I also get this new warning on Java 11 ( not sure if its relevant/related):
--- maven-scripting-plugin:3.0.0:eval (generate-definition-files) @ my-schema ---
[To redirect Truffle log output to a file use one of the following options:
* '--log.file=<path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=<path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.]
[engine] WARNING: The polyglot context is using an implementation that does not support runtime compilation.
The guest application code will therefore be executed in interpreted mode only.
Execution only in interpreted mode will strongly impact the guest application performance.
For more information on using GraalVM see https://www.graalvm.org/java/quickstart/.
To disable this warning the '--engine.WarnInterpreterOnly=false' option or use the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.
This is the snippet of code that the stack trace refers to:
function convertProperties(entityName, esProperties)
{
return Object.entries(esProperties) // Why am I getting TypeError: (intermediate value).entries is not a function now with Java 11?
.filter(prop => !(prop[1]["_s&a"] || {}).hidden)
.filter(prop => prop[1].type !== "join")
.filter(prop => ((prop[1]["_s&a"] || {}).entities || ["item"]).includes(entityName))
.map(convertProperty)
.sort(compareNames);
}
Does anyone know what I'm missing to make this work on Java 11?
I added an additional dependency as well but I still get the same error:
I also tried to use the original version of graal as I was using for Java 8 (20.1.0), but that gave me a different error:
Caused by: org.graalvm.polyglot.PolyglotException: C:\Users\me\src\my-proj\schema\target\generated-sources\schema
at sun.nio.fs.WindowsException.translateToIOException (WindowsException.java:85)
at sun.nio.fs.WindowsException.rethrowAsIOException (WindowsException.java:103)
at sun.nio.fs.WindowsException.rethrowAsIOException (WindowsException.java:108)
at sun.nio.fs.WindowsFileSystemProvider.createDirectory (WindowsFileSystemProvider.java:509)
at java.nio.file.Files.createDirectory (Files.java:689)
at <js>.:program (C:\Users\me\src\my-proj\schema\src\main\scripts\esMappingsPlus.js:1636)
at org.graalvm.polyglot.Context.eval (Context.java:345)
at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval (GraalJSScriptEngine.java:379)
at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval (GraalJSScriptEngine.java:343)
at javax.script.AbstractScriptEngine.eval (AbstractScriptEngine.java:249)
at io.github.yas99en.mojo.script.ExecuteMojo.evalScriptFile (ExecuteMojo.java:171)
at io.github.yas99en.mojo.script.ExecuteMojo.evaluate (ExecuteMojo.java:110)
at io.github.yas99en.mojo.script.ExecuteMojo.execute (ExecuteMojo.java:75)
The text was updated successfully, but these errors were encountered:
The mentioned TypeError shows that Object.entries is not a function. I guess that it is undefined. Moreover, I guess that you use Nashorn compatibility mode because that is the most natural reason why Object.entries worked for you in GraalVM 20.1.0 and does not work in 22.0.0.
Note that Nashorn is based on ECMAScript 5.1 by default (and has a bit of ECMAScript 6 features behind a flag). On the other hand, Object.entries is ECMAScript 8 (2017) feature. So, it should not be available in Nashorn compatibility mode (by default at least). Various ECMAScript 6+ built-ins were available in Nashorn compatibility mode in past but just ECMAScript 5 features are available in this mode since GraalVM 21.2.0.
I see that you use ScriptEngine API. So, if you want to re-enable Object.entries then you should set polyglot.js.ecmascript-version System property to "2017" (or higher). Alternatively, if you don't want to use this global setting then you can enable Object.entries in a selected ScriptEngine using:
Hi, hoping someone can help me.
I had a Java 8 project that was using a maven plugin to execute a js script. It worked as expected:
I have upgraded to project to Java 11 (and the graal version from 20.1.0 above to 22.0.0) and am now getting the following error:
I also get this new warning on Java 11 ( not sure if its relevant/related):
This is the snippet of code that the stack trace refers to:
Does anyone know what I'm missing to make this work on Java 11?
I added an additional dependency as well but I still get the same error:
I also tried to use the original version of graal as I was using for Java 8 (20.1.0), but that gave me a different error:
The text was updated successfully, but these errors were encountered: