Skip to content

Native imagem with ApplicationContextInitializer could not be found #40926

@georgeoikawapp

Description

@georgeoikawapp

Hello, I'm trying to run a native image generated with springboot 3.2.6 and graalvm-jdk-21.0.3, but when the application tries to start the following error occurs. Would anyone know what could be going on?

Application run failed
org.springframework.boot.AotInitializerNotFoundException: Startup with AOT mode enabled failed: AOT initializer com.picpay.ResidenceAssistenceApplication__ApplicationContextInitializer could not be found
at org.springframework.boot.SpringApplication.addAotGeneratedInitializerIfNecessary(SpringApplication.java:443)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:400)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:334)
at com.picpay.ResidenceAssistenceApplication.main(ResidenceAssistenceApplication.java:18)
at java.base@21.0.3/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

My configurations:


<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.4.1</version>
          <configuration>
	          <archive>
		          <manifest>
			          <mainClass>com.main.Class</mainClass>
		          </manifest>
	          </archive>
          </configuration>
          </plugin>
          <plugin>
          <groupId>org.graalvm.buildtools</groupId>
          <artifactId>native-maven-plugin</artifactId>
          <version>0.10.2</version>
          <configuration>
	          <imageName>${project.artifactId}</imageName>
	          <verbose>true</verbose>
	          <buildArgs>
		          <arg>--initialize-at-build-time=org.apache.commons.logging.LogFactoryService,org.apache.commons.logging.LogFactory,org.slf4j.LoggerFactory,ch.qos.logback,org.slf4j.LoggerFactory,ch.qos.logback.core.status.StatusBase,ch.qos.logback.classic.Level,ch.qos.logback.core.status.InfoStatus</arg>
	          </buildArgs>
          </configuration>
          <executions>
	          <execution>
		          <id>build-native</id>
		          <goals>
			          <goal>compile-no-fork</goal>
		          </goals>
		          <phase>package</phase>
	          </execution>
          </executions>
          </plugin>
          <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <configuration>
	          <mainClass>com.main.Class</mainClass>
          </configuration>
          </plugin>

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions