Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Add actuator support #9

Closed
mbagliojr opened this issue Oct 15, 2019 · 4 comments
Closed

Add actuator support #9

mbagliojr opened this issue Oct 15, 2019 · 4 comments
Assignees
Labels
type: compatibility Native image compatibility issue
Milestone

Comments

@mbagliojr
Copy link

mbagliojr commented Oct 15, 2019

I'm seeing the error below when trying to use the command line runner example.

No @CompilationHint found for import selector: org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextConfigurationImportSelector

What is the best way to determine the root cause of an error during native-image?

@sdeleuze sdeleuze added in: samples status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 2, 2019
@aclement
Copy link
Contributor

aclement commented Dec 3, 2019

Many errors are very confusing. And currently if you stray much beyond the existing usage demonstrated in samples, it will start failing (it is still pre 1.0).

That said, if you ever get a 'class not found' type message you can quickly try to fix that yourself by creating your own reflect-config.json file in the project META-INF/native-image folder, per the instructions in https://github.com/oracle/graal/blob/master/substratevm/REFLECTION.md.

However, in this case the feature is trying to tell you something early so we don't get a very cryptic error later. The features encapsulates hints on various types that suggest "oh if this type is being used, we need to make sure graal can reflect on these other types". At the moment each selector needs specific handling that specifics what types it might select. We'll need to add handling for ManagementContextConfigurationImportSelector.

@aclement aclement removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 8, 2020
@sdeleuze sdeleuze changed the title No @CompilationHint found for import selector: org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextConfigurationImportSelector Add actuator support Jan 21, 2020
@sdeleuze sdeleuze added type: compatibility Native image compatibility issue type: feature and removed in: samples labels Jan 21, 2020
@sdeleuze
Copy link
Contributor

This error happens when you add actuator support, so I turn it into a more general one.

@sdeleuze sdeleuze added this to the v0.7.0 milestone Jan 21, 2020
@YanzheL
Copy link

YanzheL commented Jan 27, 2020

Similar error happened in spring-kafka-2.3.1-RELEASE

Fatal error: java.lang.IllegalStateException: java.lang.IllegalStateException: No @CompilationHint found for import selector: org.springframework.kafka.annotation.KafkaListenerConfigurationSelector
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:600)
        at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:462)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:315)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:454)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:115)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:479)
Caused by: java.lang.IllegalStateException: No @CompilationHint found for import selector: org.springframework.kafka.annotation.KafkaListenerConfigurationSelector
        at org.springframework.graal.type.Type.getHints(Type.java:819)
        at org.springframework.graal.support.ResourcesHandler.processType(ResourcesHandler.java:619)
        at org.springframework.graal.support.ResourcesHandler.processType(ResourcesHandler.java:859)
        at org.springframework.graal.support.ResourcesHandler.processType(ResourcesHandler.java:898)
        at org.springframework.graal.support.ResourcesHandler.processType(ResourcesHandler.java:859)
        at org.springframework.graal.support.ResourcesHandler.processType(ResourcesHandler.java:531)
        at org.springframework.graal.support.ResourcesHandler.checkAndRegisterConfigurationType(ResourcesHandler.java:518)
        at org.springframework.graal.support.ResourcesHandler.processSpringFactory(ResourcesHandler.java:461)
        at org.springframework.graal.support.ResourcesHandler.processSpringFactories(ResourcesHandler.java:321)
        at org.springframework.graal.support.ResourcesHandler.register(ResourcesHandler.java:104)
        at org.springframework.graal.support.SpringFeature.beforeAnalysis(SpringFeature.java:79)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:669)
        at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:63)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:669)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:530)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Error: Image build request failed with exit status 1
com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 1
        at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1482)
        at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1260)
        at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1222)
        at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1181)
        at com.oracle.svm.driver.NativeImage$JDK9Plus.main(NativeImage.java:1665)

So this issue is not specific to spring-actuator, and it requires a more general solution.

@sdeleuze sdeleuze removed this from the v0.7.0 milestone Apr 17, 2020
@aclement aclement added this to the v0.7.0 milestone May 19, 2020
@aclement aclement self-assigned this May 19, 2020
@aclement
Copy link
Contributor

There are now actuator samples in the repository so the feature does support basic usage of actuator - please try it out and let me know how it goes.

So this issue is not specific to spring-actuator, and it requires a more general solution.

The problem is difficult to solve in the general sense because import selectors can do anything they want in code to compute the result of calling them at runtime. It isn't reasonable to analyze the code to work it out, so we need a hint. The messages coming out now are warning there is no hint and failing early rather than more cryptically later. The docs discuss how to create a hint when you get the problem (and perhaps contribute it back):

https://repo.spring.io/milestone/org/springframework/experimental/spring-graal-native-docs/0.6.1.RELEASE/spring-graal-native-docs-0.6.1.RELEASE.zip!/reference/index.html#_no_access_hint_found_for_import_selector_xxx

Supporting actuator was writing a complicated hint. But as I was there I also dropped one in for the KafkaListenerConfigurationSelector - however there will be import selectors out in the wild that we have no idea about, and supplying hints with them (or turning this error down to warning if you want to risk it) is the current mechanism to support it.

Please reopen if actuator not behaving for you, I am pretty sure our two samples do not cover it exhaustively.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: compatibility Native image compatibility issue
Development

No branches or pull requests

4 participants