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

GraalVM native error with Kotlin DSL #31618

Closed
Kotlin-GDE opened this issue Nov 17, 2023 · 1 comment
Closed

GraalVM native error with Kotlin DSL #31618

Kotlin-GDE opened this issue Nov 17, 2023 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@Kotlin-GDE
Copy link

Kotlin-GDE commented Nov 17, 2023

Hi

with kotlin 1.9.20, java 21 graalce, spring boot 3.2.0-rc2

sample of spring boot code

@SpringBootApplication
class DemoApplication

fun routes() = coRouter {
    GET("/") { ok().bodyValueAndAwait("hi") }
    GET("/{id}") { ok().bodyValueAndAwait("id: ${it.pathVariable("id")}") }
}

fun main() {
    runApplication<DemoApplication> {
        addInitializers(beans {
            bean(::routes)
        })
    }
}

error when generate native executable:

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::            (v3.2.0-RC2)

2023-11-17T13:14:30.309+01:00  INFO 6164 --- [           main] com.example.demo.DemoApplicationKt       : Starting DemoApplicationKt using Java 21 with PID 6164 (/home/halim/Bureau/demo/build/classes/kotlin/main started by halim in /home/halim/Bureau/demo)
2023-11-17T13:14:30.314+01:00  INFO 6164 --- [           main] com.example.demo.DemoApplicationKt       : No active profile set, falling back to 1 default profile: "default"
Exception in thread "main" java.lang.IllegalStateException: Default code generation is not supported for bean definitions declaring an instance supplier callback: Root bean: class [org.springframework.web.reactive.function.server.RouterFunction]; scope=singleton; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodNames=null; destroyMethodNames=null
        at org.springframework.beans.factory.aot.DefaultBeanRegistrationCodeFragments.getTarget(DefaultBeanRegistrationCodeFragments.java:78)
        at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:85)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$generateRegisterBeanDefinitionsMethod$2(BeanRegistrationsAotContribution.java:90)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:986)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.generateRegisterBeanDefinitionsMethod(BeanRegistrationsAotContribution.java:88)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$applyTo$1(BeanRegistrationsAotContribution.java:73)
        at org.springframework.aot.generate.GeneratedMethod.<init>(GeneratedMethod.java:54)
        at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:112)
        at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:89)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.applyTo(BeanRegistrationsAotContribution.java:72)
        at org.springframework.context.aot.BeanFactoryInitializationAotContributions.applyTo(BeanFactoryInitializationAotContributions.java:78)
        at org.springframework.context.aot.ApplicationContextAotGenerator.lambda$processAheadOfTime$0(ApplicationContextAotGenerator.java:58)
        at org.springframework.context.aot.ApplicationContextAotGenerator.withCglibClassHandler(ApplicationContextAotGenerator.java:67)
        at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:53)
        at org.springframework.context.aot.ContextAotProcessor.performAotProcessing(ContextAotProcessor.java:106)
        at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:84)
        at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:49)
        at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:82)
        at org.springframework.boot.SpringApplicationAotProcessor.main(SpringApplicationAotProcessor.java:80)

> Task :processAot FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processAot'.
> Process 'command '/home/halim/.sdkman/candidates/java/21-graalce/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 10s
5 actionable tasks: 3 executed, 2 up-to-date
@Kotlin-GDE Kotlin-GDE changed the title GraalVM native error with Koltin Functional DSL GraalVM native error with Kotlin Functional DSL Nov 17, 2023
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 17, 2023
@Kotlin-GDE Kotlin-GDE changed the title GraalVM native error with Kotlin Functional DSL GraalVM native error with Kotlin DSL Nov 17, 2023
@snicoll
Copy link
Member

snicoll commented Nov 17, 2023

Duplicate of #29555

@snicoll snicoll marked this as a duplicate of #29555 Nov 17, 2023
@snicoll snicoll closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2023
@snicoll snicoll added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants