Problem launching an application using spring-cloud-azure-starter-active-directory 4.0.0

David Lebrisse 0 Reputation points
2024-09-27T13:51:23.1833333+00:00

Hello everyone,

We are currently working on a project using :

  • Java 8
  • Spring Boot 2.2.4
  • Spring 4.3.17
  • Maven 3.9.6

As part of an initial migration from spring boot 2.2.4 to 2.5.0, we had to upgrade the azure-spring-boot-starter-active-directory version successively from 2.3.5 to 4.0.0. From version 4.0.0+, we noticed that the dependency had changed name to spring-cloud-azure-starter-active-directory, which starts at version 4.0.0, so we switched dependencies to continue our upgrade.

We made the necessary changes indicated by the migration guides for both Spring/Spring Boot and azure-spring-boot-starter/spring-cloud-azure-starter.

We are now in the following configuration:

  • Spring Boot 2.5.0
  • Spring 5.3.7

We declare the following dependencies

  • spring-boot-starter-parent 2.5.0 (parent in pom.xml)
  • spring-boot-dependencies (parent of spring-boot-starter parent)
  • spring-boot-starter-oauth2-client (version defined via spring-boot-dependencies)
  • spring-cloud-azure-dependencies 4.0.0 (via dependencyManagement section in pom.xml)
  • spring-cloud-azure-starter-active-directory (version defined via spring-cloud-azure-dependencies)

Also, we do not deploy our application through Azure Spring Cloud but through our own deployment system.

After making all the changes required for version upgrades, the project build via "mvn clean install" works.

However, when we launch the application, we encounter the following error:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.5.0)

24-09-27 ven. 10:51:33.965 INFO  40920 --- [    main] MyApp                                : Starting MyApp using Java 1.8.0_301 on DELL-LAP02 with PID 40920 (C:\Git\POC\my-webapp\target\classes started by user in C:\Git\POC)
24-09-27 ven. 10:51:33.966 INFO  40920 --- [    main] MyApp                                : The following profiles are active: dev,dev-user
24-09-27 ven. 10:51:34.069 WARN  40920 --- [kground-preinit] Jackson2ObjectMapperBuilder              : For Jackson Kotlin classes support please add "com.fasterxml.jackson.module:jackson-module-kotlin" to the classpath
24-09-27 ven. 10:51:42.299 WARN  40920 --- [    main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.MyApp]; nested exception is java.lang.IllegalArgumentException: Could not find class [com.azure.messaging.eventhubs.CheckpointStore]
24-09-27 ven. 10:51:42.307 INFO  40920 --- [    main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
24-09-27 ven. 10:51:42.357 ERROR 40920 --- [    main] SpringApplication                        : Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.MyApp]; nested exception is java.lang.IllegalArgumentException: Could not find class [com.azure.messaging.eventhubs.CheckpointStore]
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:189)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:337)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1336)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1325)
	at com.MyApp.main(MyApp.java:134)
Caused by: java.lang.IllegalArgumentException: Could not find class [com.azure.messaging.eventhubs.CheckpointStore]
	at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:334)
	at org.springframework.core.annotation.TypeMappedAnnotation.adapt(TypeMappedAnnotation.java:446)
	at org.springframework.core.annotation.TypeMappedAnnotation.getValue(TypeMappedAnnotation.java:369)
	at org.springframework.core.annotation.TypeMappedAnnotation.asMap(TypeMappedAnnotation.java:284)
	at org.springframework.core.annotation.AbstractMergedAnnotation.asAnnotationAttributes(AbstractMergedAnnotation.java:193)
	at org.springframework.core.type.AnnotatedTypeMetadata.getAnnotationAttributes(AnnotatedTypeMetadata.java:106)
	at org.springframework.context.annotation.AnnotationConfigUtils.attributesFor(AnnotationConfigUtils.java:285)
	at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:102)
	at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:81)
	at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:280)
	at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132)
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:296)
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:250)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:207)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:175)
	... 13 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.azure.messaging.eventhubs.CheckpointStore
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at org.springframework.util.ClassUtils.forName(ClassUtils.java:284)
	at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:324)
	... 27 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:55659', transport: 'socket'

Process finished with exit code 1

Do you have any ideas as to what might be causing this error? Has the use of eventhubs become mandatory? If necessary, we can provide more information.

Thank you in advance.

Azure Spring Apps
Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
130 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.