I have a spring boot java app that I trying to port to Java 11. Perhaps due to module system or usage of "internal" API my app fails to start. Here's a portion of the stack trace:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.3)
2021-03-29T17:25:59.216+0000 ERROR [ "main"] [o.s.b.SpringApplication@856 ] Application run failed java.lang.NoClassDefFoundError: jdk/internal/reflect/GeneratedConstructorAccessor34
at java.base/jdk.internal.reflect.GeneratedConstructorAccessor34.newInstance(Unknown Source)
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.lang.reflect.Proxy.newProxyInstance(Proxy.java:1022)
at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1008)
at java.base/sun.reflect.annotation.AnnotationParser$1.run(AnnotationParser.java:306)
at java.base/sun.reflect.annotation.AnnotationParser$1.run(AnnotationParser.java:304)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:304)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:294)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:121)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:73)
at java.base/java.lang.Class.createAnnotationData(Class.java:3757)
at java.base/java.lang.Class.annotationData(Class.java:3746)
at java.base/java.lang.Class.getAnnotation(Class.java:3651)
at java.base/java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:274)
at java.base/java.lang.Class.isAnnotationPresent(Class.java:3661)
at org.springframework.core.type.filter.AnnotationTypeFilter.<init>(AnnotationTypeFilter.java:83)
at org.springframework.core.type.filter.AnnotationTypeFilter.<init>(AnnotationTypeFilter.java:61)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.registerDefaultFilters(ClassPathScanningCandidateComponentProvider.java:206)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.<init>(ClassPathBeanDefinitionScanner.java:166)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.<init>(ClassPathBeanDefinitionScanner.java:140)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.<init>(ClassPathBeanDefinitionScanner.java:113)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.<init>(ClassPathBeanDefinitionScanner.java:85)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:71)
at org.springframework.boot.ApplicationContextFactory.lambda$static$0(ApplicationContextFactory.java:52)
at org.springframework.boot.SpringApplication.createApplicationContext(SpringApplication.java:597)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:323)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
at com.intuit.platform.jsk.sample.Application.main(Application.java:10)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:107)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Comment From: qcloop
our application runs with jacoco runtime agent for instrumentation. It turns out it was causing issues, not spring boot. Whoever runs with jacoco runtime agent make sure to run a version compatible with Java 11, which probably be 0.8.7