Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with GraalVM #397

Open
ivansenic opened this issue Jun 24, 2022 · 0 comments
Open

Not compatible with GraalVM #397

ivansenic opened this issue Jun 24, 2022 · 0 comments

Comments

@ivansenic
Copy link

ivansenic commented Jun 24, 2022

Trying to build a native image for the application that uses this schema validator, fails with the following exception:

Fatal error: org.graalvm.compiler.debug.GraalError: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image runtime.  Object has been initialized by the com.github.fge.jsonschema.cfg.ValidationConfigurationBuilder class initializer with a trace: 
 	at java.lang.Thread.<init>(Thread.java:708)
	at java.util.concurrent.Executors$DefaultThreadFactory.newThread(Executors.java:660)
	at com.github.fge.msgsimple.provider.LoadingMessageSourceProvider$1.newThread(LoadingMessageSourceProvider.java:91)
	at java.util.concurrent.ThreadPoolExecutor$Worker.<init>(ThreadPoolExecutor.java:630)
	at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:920)
	at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1353)
	at com.github.fge.msgsimple.provider.LoadingMessageSourceProvider.getMessageSource(LoadingMessageSourceProvider.java:190)
	at com.github.fge.msgsimple.bundle.MessageBundle.getMessage(MessageBundle.java:122)
	at com.github.fge.msgsimple.bundle.MessageBundle.getMessage(MessageBundle.java:146)
	at com.github.fge.jackson.JsonNodeReader.readNode(JsonNodeReader.java:147)
	at com.github.fge.jackson.JsonNodeReader.fromInputStream(JsonNodeReader.java:101)
	at com.github.fge.jackson.JsonLoader.fromURL(JsonLoader.java:122)
	at com.github.fge.jsonschema.SchemaVersion.<init>(SchemaVersion.java:66)
	at com.github.fge.jsonschema.SchemaVersion.<clinit>(SchemaVersion.java:45)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Unknown Source)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:568)
	at java.lang.Class.getEnumConstantsShared(Class.java:3837)
	at java.lang.System$2.getEnumConstantsShared(System.java:2284)
	at java.util.EnumMap.getKeyUniverse(EnumMap.java:747)
	at java.util.EnumMap.<init>(EnumMap.java:135)
	at com.google.common.collect.Maps.newEnumMap(Maps.java:423)
	at com.github.fge.jsonschema.cfg.ValidationConfigurationBuilder.<clinit>(ValidationConfigurationBuilder.java:62)
. Try avoiding to initialize the class that caused initialization of the Thread. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
	at com.oracle.graal.pointsto.util.AnalysisFuture.setException(AnalysisFuture.java:49)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:269)
	at com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
	at com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$postTask$9(ImageHeapScanner.java:611)
	at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Used GraalVM props:

 Version info: 'GraalVM 22.1.0 Java 17 CE'
 C compiler: gcc (redhat, x86_64, 8.5.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant