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

Docker Compose support produces non-working native image #35676

Closed
mhalbritter opened this issue May 30, 2023 · 1 comment
Closed

Docker Compose support produces non-working native image #35676

mhalbritter opened this issue May 30, 2023 · 1 comment
Labels
theme: aot An issue related to Ahead-of-time processing theme: containers Testcontainers, Docker Compose and Buildpack features type: bug A general bug
Milestone

Comments

@mhalbritter
Copy link
Contributor

When using spring-boot-docker-compose with a native image, the resulting native image doesn't start up:

Exception in thread "main" java.lang.IllegalArgumentException: Unable to instantiate factory class [org.springframework.boot.docker.compose.lifecycle.DockerComposeListener] for factory type [org.springframework.context.ApplicationListener]
        at org.springframework.core.io.support.SpringFactoriesLoader$FailureHandler.lambda$throwing$0(SpringFactoriesLoader.java:651)classes/                                                                                                                                           
        at org.springframework.core.io.support.SpringFactoriesLoader$FailureHandler.lambda$handleMessage$3(SpringFactoriesLoader.java:675)
        at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:231)
        at org.springframework.core.io.support.SpringFactoriesLoader.load(SpringFactoriesLoader.java:206)
        at org.springframework.core.io.support.SpringFactoriesLoader.load(SpringFactoriesLoader.java:160)
        at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:462)
        at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:458)
        at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:275)
        at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:253)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1305)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1294)
        at com.example.demo.DemoApplication.main(DemoApplication.java:10)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.docker.compose.lifecycle.DockerComposeListener
        at [email protected]/java.lang.Class.forName(DynamicHub.java:1132)
        at org.springframework.util.ClassUtils.forName(ClassUtils.java:284)
        at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:224)
        ... 9 more

I've tested it with 3.1.1-SNAPSHOT. This only happens with Maven. With Gradle it's fine.

The dependency is declared like this:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-docker-compose</artifactId>
            <optional>true</optional>
        </dependency>

Reproducer: demo.zip

@mhalbritter mhalbritter added type: bug A general bug theme: aot An issue related to Ahead-of-time processing theme: containers Testcontainers, Docker Compose and Buildpack features labels May 30, 2023
@mhalbritter mhalbritter added this to the 3.1.x milestone May 30, 2023
@wilkinsona
Copy link
Member

wilkinsona commented May 30, 2023

See #35548. It looks like the fix there didn't go far enough as it hasn't addressed the native image side of things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: aot An issue related to Ahead-of-time processing theme: containers Testcontainers, Docker Compose and Buildpack features type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants