Skip to content

DevTools prevent startup in native image with ClassNotFoundException #35853

@trisberg

Description

@trisberg

Building and running web app as native image fails with java.lang.ClassNotFoundException after upgrade to Boot 3.1.0 from 3.0.5.

Sample project pom.xml for 3.0.x - https://github.com/trisberg/tanzu-java-web-app/blob/main/pom.xml
Same after update to Boot 3.1 - https://github.com/trisberg/tanzu-java-web-app/blob/boot31/pom.xml

The exception:

2023-06-11T09:52:54.937486462-04:00 Exception in thread "main" java.lang.IllegalArgumentException: Unable to instantiate factory class [org.springframework.boot.devtools.restart.RestartScopeInitializer] for factory type [org.springframework.context.ApplicationContextInitializer]
2023-06-11T09:52:54.937538656-04:00 	at org.springframework.core.io.support.SpringFactoriesLoader$FailureHandler.lambda$throwing$0(SpringFactoriesLoader.java:651)
2023-06-11T09:52:54.937546131-04:00 	at org.springframework.core.io.support.SpringFactoriesLoader$FailureHandler.lambda$handleMessage$3(SpringFactoriesLoader.java:675)
2023-06-11T09:52:54.937551864-04:00 	at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:231)
2023-06-11T09:52:54.937556622-04:00 	at org.springframework.core.io.support.SpringFactoriesLoader.load(SpringFactoriesLoader.java:206)
2023-06-11T09:52:54.937561230-04:00 	at org.springframework.core.io.support.SpringFactoriesLoader.load(SpringFactoriesLoader.java:160)
2023-06-11T09:52:54.937566131-04:00 	at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:462)
2023-06-11T09:52:54.937570912-04:00 	at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:458)
2023-06-11T09:52:54.937576500-04:00 	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:274)
2023-06-11T09:52:54.937581639-04:00 	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:253)
2023-06-11T09:52:54.937587087-04:00 	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1305)
2023-06-11T09:52:54.937591930-04:00 	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1294)
2023-06-11T09:52:54.937596813-04:00 	at com.example.springboot.Application.main(Application.java:17)
2023-06-11T09:52:54.937601696-04:00 Caused by: java.lang.ClassNotFoundException: org.springframework.boot.devtools.restart.RestartScopeInitializer
2023-06-11T09:52:54.937609439-04:00 	at java.base@17.0.6/java.lang.Class.forName(DynamicHub.java:1132)
2023-06-11T09:52:54.937614517-04:00 	at org.springframework.util.ClassUtils.forName(ClassUtils.java:284)
2023-06-11T09:52:54.937619527-04:00 	at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:224)
2023-06-11T09:52:54.937624712-04:00 	... 9 more

Metadata

Metadata

Assignees

Labels

theme: aotAn issue related to Ahead-of-time processingtype: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions