Git Product home page Git Product logo

Comments (4)

aclement avatar aclement commented on May 12, 2024

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.

from spring-native.

sdeleuze avatar sdeleuze commented on May 12, 2024

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

from spring-native.

YanzheL avatar YanzheL commented on May 12, 2024

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.

from spring-native.

aclement avatar aclement commented on May 12, 2024

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.

from spring-native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.