The standalone formatter tvdformat.jar, version 21.4.2 works with Java 8, 11 and 17. It requires a JDK 17 to build. Building the executable JAR works with "Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)". But when I try to build it with the GraalVM CE 22.0.0.2 (mvn clean package)I get various test errors. Here are some examples:
[INFO] Running com.trivadis.plsql.formatter.settings.tests.grammar.Json_functions
[ERROR] Tests run: 4, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 5.319 s <<< FAILURE! - in com.trivadis.plsql.formatter.settings.tests.grammar.Json_functions
[ERROR] json_value_on_same_line Time elapsed: 1.359 s <<< FAILURE!
java.lang.AssertionError: oracle.dbtools.arbori.ScriptException: org.graalvm.polyglot.PolyglotException: java.lang.AssertionError
at com.trivadis.plsql.formatter.settings.tests.grammar.Json_functions.json_value_on_same_line(Json_functions.java:91)
Caused by: oracle.dbtools.arbori.ScriptException: org.graalvm.polyglot.PolyglotException: java.lang.AssertionError
at com.trivadis.plsql.formatter.settings.tests.grammar.Json_functions.json_value_on_same_line(Json_functions.java:91)
Caused by: javax.script.ScriptException: org.graalvm.polyglot.PolyglotException: java.lang.AssertionError
at com.trivadis.plsql.formatter.settings.tests.grammar.Json_functions.json_value_on_same_line(Json_functions.java:91)
Caused by: org.graalvm.polyglot.PolyglotException: java.lang.AssertionError
at com.trivadis.plsql.formatter.settings.tests.grammar.Json_functions.json_value_on_same_line(Json_functions.java:91)
(...)
org.graalvm.js.scriptengine/com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.invokeFunction(GraalJSScriptEngine.java:556)
at oracle.dbtools.arbori.JSFunc.eval(Predicate.java:968)
at oracle.dbtools.arbori.CompositeExpr.eval(Predicate.java:1057)
at oracle.dbtools.arbori.CompositeExpr.eval(Predicate.java:1057)
at oracle.dbtools.arbori.CompositeExpr.eval(Predicate.java:1059)
(...)
at oracle.dbtools.arbori.CompositeExpr.eval(Predicate.java:1059)
at oracle.dbtools.arbori.IndependentAttribute.filterUnaryPredicates(IndependentAttribute.java:235)
at oracle.dbtools.arbori.IndependentAttribute.addTuples(IndependentAttribute.java:112)
at oracle.dbtools.arbori.IndependentAttribute.initContent(IndependentAttribute.java:69)
at oracle.dbtools.arbori.AttributeDefinitions.evalDimensions(AttributeDefinitions.java:232)
at oracle.dbtools.arbori.Program.evalDimensions(Program.java:1391)
at oracle.dbtools.arbori.Program$PredicateCmd._eval(Program.java:1483)
at oracle.dbtools.arbori.Program$PredicateCmd.eval(Program.java:1452)
at oracle.dbtools.arbori.Program.eval(Program.java:1267)
at oracle.dbtools.app.Format.format(Format.java:375)
at <js>.formatFile(<eval>:538)
at <js>.formatFiles(<eval>:550)
at <js>.run(<eval>:604)
at <js>.handleEvent(<eval>:639)
... 79 more
When I run mvn -DskipTests=true clean package a working tvdformat.jar is produced.
It looks like a testing issue only, but it is not. I cannot produce a native image with GraalVM 22.0.0.2.
When I run mvn -Dskip.native=false -DskipTests=true clean package the following output is produced
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------< com.trivadis.plsql.formatter:tvdformat >---------------
[INFO] Building com.trivadis.org.plsql.formatter.settings 21.4.3-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tvdformat ---
[INFO] Deleting /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tvdformat ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ tvdformat ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ tvdformat ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 10 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ tvdformat ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 171 source files to /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ tvdformat ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ tvdformat ---
[INFO] Building jar: /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat-21.4.3-SNAPSHOT.jar
[INFO]
[INFO] --- maven-shade-plugin:3.2.4:shade (default) @ tvdformat ---
[INFO] Including org.graalvm.js:js:jar:22.0.0.2 in the shaded jar.
[INFO] Including org.graalvm.regex:regex:jar:22.0.0.2 in the shaded jar.
[INFO] Including org.graalvm.truffle:truffle-api:jar:22.0.0.2 in the shaded jar.
[INFO] Including org.graalvm.sdk:graal-sdk:jar:22.0.0.2 in the shaded jar.
[INFO] Including org.graalvm.js:js-scriptengine:jar:22.0.0.2 in the shaded jar.
[INFO] Including com.google.code.findbugs:jsr305:jar:3.0.2 in the shaded jar.
[INFO] Including oracle.dbtools:dbtools-common:jar:21.4.1 in the shaded jar.
[INFO] Including org.reflections:reflections:jar:0.10.2 in the shaded jar.
[INFO] Including org.javassist:javassist:jar:3.28.0-GA in the shaded jar.
[INFO] Including org.slf4j:slf4j-api:jar:1.7.32 in the shaded jar.
[INFO] Including org.slf4j:slf4j-jdk14:jar:1.7.32 in the shaded jar.
[INFO] Replacing /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat.jar with /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat-21.4.3-SNAPSHOT-shaded.jar
[INFO]
[INFO] --- native-maven-plugin:0.9.9:build (build-native) @ tvdformat ---
[INFO] Executing: /Users/phs/Applications/graalvm-ce-java17-22.0.0.2/Contents/Home/bin/native-image -cp /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat-21.4.3-SNAPSHOT.jar:/Users/phs/.m2/repository/oracle/dbtools/dbtools-common/21.4.1/dbtools-common-21.4.1.jar:/Users/phs/.m2/repository/org/reflections/reflections/0.10.2/reflections-0.10.2.jar:/Users/phs/.m2/repository/org/javassist/javassist/3.28.0-GA/javassist-3.28.0-GA.jar:/Users/phs/.m2/repository/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.jar:/Users/phs/.m2/repository/org/slf4j/slf4j-jdk14/1.7.32/slf4j-jdk14-1.7.32.jar --features=com.trivadis.plsql.formatter.RuntimeReflectionRegistrationFeature --language:js --no-fallback -H:+ReportExceptionStackTraces -H:Class=com.trivadis.plsql.formatter.TvdFormat -H:Name=tvdformat
========================================================================================================================
GraalVM Native Image: Generating 'tvdformat'...
========================================================================================================================
[1/7] Initializing...
(6.4s @ 0.13GB)
Error: Error parsing JNI configuration in jar:file:/Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat-21.4.3-SNAPSHOT.jar!/META-INF/native-image/com.trivadis.plsql.formatter/tvdformat/jni-config.json:
Could not resolve org.graalvm.nativebridge.jni.JNIExceptionWrapperEntryPoints for reflection configuration. Reason: java.lang.ClassNotFoundException: org.graalvm.nativebridge.jni.JNIExceptionWrapperEntryPoints. To allow unresolvable reflection configuration, use option --allow-incomplete-classpath
Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option JNIConfigurationResources.
com.oracle.svm.core.util.UserError$UserException: Error parsing JNI configuration in jar:file:/Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat-21.4.3-SNAPSHOT.jar!/META-INF/native-image/com.trivadis.plsql.formatter/tvdformat/jni-config.json:
Could not resolve org.graalvm.nativebridge.jni.JNIExceptionWrapperEntryPoints for reflection configuration. Reason: java.lang.ClassNotFoundException: org.graalvm.nativebridge.jni.JNIExceptionWrapperEntryPoints. To allow unresolvable reflection configuration, use option --allow-incomplete-classpath
Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option JNIConfigurationResources.
at com.oracle.svm.core.util.UserError.abort(UserError.java:73)
at com.oracle.svm.hosted.config.ConfigurationParserUtils.doParseAndRegister(ConfigurationParserUtils.java:135)
at com.oracle.svm.hosted.config.ConfigurationParserUtils.lambda$parseAndRegisterConfigurations$3(ConfigurationParserUtils.java:113)
at java.base/java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:214)
at com.oracle.svm.hosted.config.ConfigurationParserUtils$1.tryAdvance(ConfigurationParserUtils.java:106)
at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:332)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:515)
at java.base/java.util.stream.IntPipeline.sum(IntPipeline.java:473)
at com.oracle.svm.hosted.config.ConfigurationParserUtils.parseAndRegisterConfigurations(ConfigurationParserUtils.java:115)
at com.oracle.svm.jni.access.JNIAccessFeature.afterRegistration(JNIAccessFeature.java:128)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$setupNativeImage$14(NativeImageGenerator.java:802)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:74)
at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:802)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:534)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:494)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:426)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:587)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:126)
at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:617)
------------------------------------------------------------------------------------------------------------------------
0.2s (3.4% of total time) in 8 GCs | Peak RSS: 0.67GB | CPU load: 3.35
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
/Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat.build_artifacts.txt
========================================================================================================================
Failed generating 'tvdformat' after 3.5s.
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.784 s
[INFO] Finished at: 2022-01-29T17:29:36+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.9.9:build (build-native) on project tvdformat: Execution of /Users/phs/Applications/graalvm-ce-java17-22.0.0.2/Contents/Home/bin/native-image -cp /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat-21.4.3-SNAPSHOT.jar:/Users/phs/.m2/repository/oracle/dbtools/dbtools-common/21.4.1/dbtools-common-21.4.1.jar:/Users/phs/.m2/repository/org/reflections/reflections/0.10.2/reflections-0.10.2.jar:/Users/phs/.m2/repository/org/javassist/javassist/3.28.0-GA/javassist-3.28.0-GA.jar:/Users/phs/.m2/repository/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.jar:/Users/phs/.m2/repository/org/slf4j/slf4j-jdk14/1.7.32/slf4j-jdk14-1.7.32.jar --features=com.trivadis.plsql.formatter.RuntimeReflectionRegistrationFeature --language:js --no-fallback -H:+ReportExceptionStackTraces -H:Class=com.trivadis.plsql.formatter.TvdFormat -H:Name=tvdformat returned non-zero result -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
It works when using "OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing)". Here's the complete output of mvn -Dskip.native=false -DskipTests=true clean package:
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------< com.trivadis.plsql.formatter:tvdformat >---------------
[INFO] Building com.trivadis.org.plsql.formatter.settings 21.4.3-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tvdformat ---
[INFO] Deleting /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tvdformat ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ tvdformat ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ tvdformat ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 10 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ tvdformat ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 171 source files to /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ tvdformat ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ tvdformat ---
[INFO] Building jar: /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat-21.4.3-SNAPSHOT.jar
[INFO]
[INFO] --- maven-shade-plugin:3.2.4:shade (default) @ tvdformat ---
[INFO] Including org.graalvm.js:js:jar:22.0.0.2 in the shaded jar.
[INFO] Including org.graalvm.regex:regex:jar:22.0.0.2 in the shaded jar.
[INFO] Including org.graalvm.truffle:truffle-api:jar:22.0.0.2 in the shaded jar.
[INFO] Including org.graalvm.sdk:graal-sdk:jar:22.0.0.2 in the shaded jar.
[INFO] Including org.graalvm.js:js-scriptengine:jar:22.0.0.2 in the shaded jar.
[INFO] Including com.google.code.findbugs:jsr305:jar:3.0.2 in the shaded jar.
[INFO] Including oracle.dbtools:dbtools-common:jar:21.4.1 in the shaded jar.
[INFO] Including org.reflections:reflections:jar:0.10.2 in the shaded jar.
[INFO] Including org.javassist:javassist:jar:3.28.0-GA in the shaded jar.
[INFO] Including org.slf4j:slf4j-api:jar:1.7.32 in the shaded jar.
[INFO] Including org.slf4j:slf4j-jdk14:jar:1.7.32 in the shaded jar.
[INFO] Replacing /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat.jar with /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat-21.4.3-SNAPSHOT-shaded.jar
[INFO]
[INFO] --- native-maven-plugin:0.9.9:build (build-native) @ tvdformat ---
[INFO] Executing: /Users/phs/Applications/graalvm-ce-java17-21.3.0/Contents/Home/bin/native-image -cp /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat-21.4.3-SNAPSHOT.jar:/Users/phs/.m2/repository/oracle/dbtools/dbtools-common/21.4.1/dbtools-common-21.4.1.jar:/Users/phs/.m2/repository/org/reflections/reflections/0.10.2/reflections-0.10.2.jar:/Users/phs/.m2/repository/org/javassist/javassist/3.28.0-GA/javassist-3.28.0-GA.jar:/Users/phs/.m2/repository/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.jar:/Users/phs/.m2/repository/org/slf4j/slf4j-jdk14/1.7.32/slf4j-jdk14-1.7.32.jar --features=com.trivadis.plsql.formatter.RuntimeReflectionRegistrationFeature --language:js --no-fallback -H:+ReportExceptionStackTraces -H:Class=com.trivadis.plsql.formatter.TvdFormat -H:Name=tvdformat
[tvdformat:52150] classlist: 3,374.18 ms, 0.94 GB
[tvdformat:52150] (cap): 2,347.33 ms, 0.94 GB
[tvdformat:52150] setup: 6,760.01 ms, 0.94 GB
Jan 29, 2022 5:35:35 PM org.reflections.Reflections scan
INFO: Reflections took 154 ms to scan 1 urls, producing 29 keys and 90 values
Jan 29, 2022 5:35:35 PM org.reflections.Reflections scan
INFO: Reflections took 43 ms to scan 1 urls, producing 13 keys and 41 values
Jan 29, 2022 5:35:35 PM org.reflections.Reflections scan
INFO: Reflections took 96 ms to scan 1 urls, producing 26 keys and 61 values
Jan 29, 2022 5:35:35 PM org.reflections.Reflections scan
INFO: Reflections took 618 ms to scan 1 urls, producing 217 keys and 1029 values
Jan 29, 2022 5:35:35 PM org.reflections.Reflections scan
INFO: Reflections took 39 ms to scan 1 urls, producing 24 keys and 39 values
[tvdformat:52150] (clinit): 1,474.15 ms, 6.17 GB
[tvdformat:52150] (typeflow): 17,653.56 ms, 6.17 GB
[tvdformat:52150] (objects): 40,138.07 ms, 6.17 GB
[tvdformat:52150] (features): 17,699.81 ms, 6.17 GB
[tvdformat:52150] analysis: 79,682.91 ms, 6.17 GB
[tvdformat:52150] universe: 4,141.25 ms, 6.17 GB
10971 method(s) included for runtime compilation
[tvdformat:52150] (parse): 12,428.48 ms, 6.29 GB
[tvdformat:52150] (inline): 7,662.57 ms, 6.97 GB
[tvdformat:52150] (compile): 41,592.58 ms, 6.77 GB
[tvdformat:52150] compile: 67,028.94 ms, 6.72 GB
[tvdformat:52150] image: 7,322.17 ms, 6.80 GB
[tvdformat:52150] write: 3,395.14 ms, 6.80 GB
[tvdformat:52150] [total]: 177,198.60 ms, 6.80 GB
# Printing build artifacts to: /Users/phs/github/trivadis/plsql-formatter-settings/standalone/target/tvdformat.build_artifacts.txt
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:11 min
[INFO] Finished at: 2022-01-29T17:38:21+01:00
[INFO] ------------------------------------------------------------------------
The standalone formatter
tvdformat.jar, version 21.4.2 works with Java 8, 11 and 17. It requires a JDK 17 to build. Building the executable JAR works with "Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)". But when I try to build it with the GraalVM CE 22.0.0.2 (mvn clean package)I get various test errors. Here are some examples:When I run
mvn -DskipTests=true clean packagea workingtvdformat.jaris produced.It looks like a testing issue only, but it is not. I cannot produce a native image with GraalVM 22.0.0.2.
When I run
mvn -Dskip.native=false -DskipTests=true clean packagethe following output is producedIt works when using "OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing)". Here's the complete output of
mvn -Dskip.native=false -DskipTests=true clean package: