Repository navigation
Spring Boot processAot fails with ojdbc library in place #3487
Description
NOTE: This comes from spring-projects/spring-boot#50623 which suggests to open the ticket here instead
With Spring Boot 4.x, having the com.oracle.database.jdbc:ojdbcX dependency in the project results in a failure to run the processAot task.
I'm specifically on com.oracle.database.jdbc:ojdbc11:23.26.2.0.0, but it happens with ojdbc17 as well.
This same library on Spring Boot 3.x isn't causing any issues.
Trying to work around it by adding com.oracle.database.ha:simplefan:23.26.2.0.0 just compounds on the issue as it then breaks and demands for another library, com.oracle.database.xml:xdb:23.26.2.0.0, which then breaks and demands for yet another, and so on and so forth -- all on libraries that I explicitly do not want on the project.
This is tested on Open JDK 17 and 21, both having the same issue.
I'm mentioning the JDK flavor here in particular because it seems Quarkus had a somewhat-similar issue in the past and blamed that, but this didn't help me here -- graalvm/mandrel#252
Exception stacktrace:
Exception in thread "main" org.springframework.beans.factory.aot.AotBeanProcessingException: Error processing bean with name 'myRepository' defined in com.foo.bar.MyRepository defined in @EnableJpaRepositories declared on DataJpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: failed to generate code for bean definition
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution$BeanDefinitionsRegistrationGenerator.lambda$generateRegisterBeanDefinitionMethods$0(BeanRegistrationsAotContribution.java:280)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution$BeanDefinitionsRegistrationGenerator.generateRegisterBeanDefinitionMethods(BeanRegistrationsAotContribution.java:270)
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution$BeanDefinitionsRegistrationGenerator.generateBeanRegistrationsCode(BeanRegistrationsAotContribution.java:238)
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$generateBeanRegistrationClass$0(BeanRegistrationsAotContribution.java:116)
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.generateBeanRegistrationClass(BeanRegistrationsAotContribution.java:110)
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.generateBeanRegistrationCode(BeanRegistrationsAotContribution.java:88)
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.applyTo(BeanRegistrationsAotContribution.java:77)
at org.springframework.context.aot.BeanFactoryInitializationAotContributions.applyTo(BeanFactoryInitializationAotContributions.java:94)
at org.springframework.context.aot.ApplicationContextAotGenerator.lambda$processAheadOfTime$0(ApplicationContextAotGenerator.java:59)
at org.springframework.context.aot.ApplicationContextAotGenerator.withCglibClassHandler(ApplicationContextAotGenerator.java:68)
at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:54)
at org.springframework.context.aot.ContextAotProcessor.performAotProcessing(ContextAotProcessor.java:107)
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:84)
at org.springframework.boot.SpringApplicationAotProcessor.main(SpringApplicationAotProcessor.java:96)
Caused by: java.lang.IllegalStateException: Failed to introspect Class [oracle.jdbc.driver.HAManager] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@5a07e868]
at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:756)
at org.springframework.util.ReflectionUtils.doWithLocalFields(ReflectionUtils.java:689)
at org.springframework.data.util.TypeCollector.visitFieldsOfType(TypeCollector.java:284)
at org.springframework.data.util.TypeCollector.processType(TypeCollector.java:221)
at org.springframework.data.util.TypeCollector.processType(TypeCollector.java:228)
at org.springframework.data.util.TypeCollector.processType(TypeCollector.java:228)
at org.springframework.data.util.TypeCollector.processType(TypeCollector.java:228)
at org.springframework.data.util.TypeCollector.processType(TypeCollector.java:228)
at org.springframework.data.util.TypeCollector.processType(TypeCollector.java:228)
at org.springframework.data.util.TypeCollector.processType(TypeCollector.java:228)
at org.springframework.data.util.TypeCollector.processType(TypeCollector.java:228)
at org.springframework.data.util.TypeCollector.processType(TypeCollector.java:228)
at org.springframework.data.util.TypeCollector.processType(TypeCollector.java:228)
at org.springframework.data.util.TypeCollector.process(TypeCollector.java:201)
at org.springframework.data.util.TypeCollector$ReachableTypes.lambda$forEach$0(TypeCollector.java:321)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.data.util.TypeCollector$ReachableTypes.forEach(TypeCollector.java:321)
at org.springframework.data.util.TypeCollector$ReachableTypes.collect(TypeCollector.java:335)
at org.springframework.data.util.Lazy.getNullable(Lazy.java:136)
at org.springframework.data.util.Lazy.get(Lazy.java:114)
at org.springframework.data.util.TypeCollector$ReachableTypes.list(TypeCollector.java:330)
at org.springframework.data.repository.config.DefaultAotRepositoryContext.discoverTypes(DefaultAotRepositoryContext.java:138)
at org.springframework.data.util.Lazy.getNullable(Lazy.java:136)
at org.springframework.data.util.Lazy.get(Lazy.java:114)
at org.springframework.data.repository.config.DefaultAotRepositoryContext.getResolvedTypes(DefaultAotRepositoryContext.java:106)
at org.springframework.data.repository.config.RepositoryRegistrationAotProcessor.configureDomainTypeContributions(RepositoryRegistrationAotProcessor.java:260)
at org.springframework.data.repository.config.RepositoryRegistrationAotProcessor.configureTypeContributions(RepositoryRegistrationAotProcessor.java:223)
at org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension$JpaRepositoryRegistrationAotProcessor.configureTypeContributions(JpaRepositoryConfigExtension.java:394)
at org.springframework.data.repository.config.RepositoryRegistrationAotProcessor.lambda$processAheadOfTime$0(RepositoryRegistrationAotProcessor.java:166)
at org.springframework.data.repository.config.RepositoryRegistrationAotContribution.applyTo(RepositoryRegistrationAotContribution.java:63)
at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.lambda$generateBeanDefinitionMethod$0(BeanDefinitionMethodGenerator.java:165)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:165)
at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:89)
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution$BeanDefinitionsRegistrationGenerator.generateBeanRegistration(BeanRegistrationsAotContribution.java:289)
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution$BeanDefinitionsRegistrationGenerator.lambda$generateRegisterBeanDefinitionMethods$0(BeanRegistrationsAotContribution.java:272)
... 19 more
Caused by: java.lang.NoClassDefFoundError: oracle/simplefan/FanManager
at java.base/java.lang.Class.getDeclaredFields0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3475)
at java.base/java.lang.Class.getDeclaredFields(Class.java:2544)
at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:751)
... 54 more
Caused by: java.lang.ClassNotFoundException: oracle.simplefan.FanManager
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
... 58 more
Activity
christophstrobl commentedon Jun 1, 2026
Thank you @blaghed for your report.
Please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem so we can see where the type lookup originates from.
blaghed commentedon Jun 1, 2026
Hm... so I was setting up an example project for you, and during it found out that by adding
@EnableJpaRepositoriesto the project, the problem disappears. No other change.So I guess we have a workaround until this is fixed.
Meanwhile, to reproduce it, you just need to have an
@Entitywith anyoracle.sql.Datumtype inside.E.g.:
The presence of the
oraclefield is included into this auto-scan logic, so it starts to drill down into it and eventually it leads to the presence of theOracleConnectionclass, which in turn references theHAManager, causing the scanning to fail as this is not present.Worth noting that I managed to get the same type of scan failure, but while using Jakarta EE API.
For example, just with these dependencies:
I get the following error also on the
processAotparticipation part of Spring Data: