Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.35k stars 1.99k forks source link

[BUG] spring boot service bus application getting java.lang.IllegalStateException: The following classes could not be excluded because they are not auto-configuration classes: - com.azure.spring.autoconfigure.aad.AADAuthenticationFilterAutoConfiguration error #19850

Closed karthikmsc05 closed 3 years ago

karthikmsc05 commented 3 years ago

Describe the bug Followed the steps as mentioned on the documentation for sending and recieving messages to an azure service bus queue, https://docs.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-service-bus

But while spring boot start up its failing with the error,

java.lang.IllegalStateException: The following classes could not be excluded because they are not auto-configuration classes: - com.azure.spring.autoconfigure.aad.AADAuthenticationFilterAutoConfiguration error

I have also tried excluding AADAuthenticationFilterAutoConfiguration from autoconfiguration as i am not using it i got the below error,

java.lang.IllegalStateException: The following classes could not be excluded because they are not auto-configuration classes:

Is it mandatory to define/configure something specifically for AADAuthenticationFilterAutoConfiguration ? If so please provide me the details if i am missing something.

Exception or Stack Trace Add the exception log and stack trace if available


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

2021-03-10 18:00:30.012 INFO 15224 --- [ main] com.att.cdo.Application : Starting Application on HVDIVD22CF01256 with PID 15224 (H:\\git\\environment-check-030921\\target\\classes started by km923h in H:\\git\\environment-check-030921)
2021-03-10 18:00:30.022 INFO 15224 --- [ main] com.att.cdo.Application : No active profile set, falling back to default profiles: default
2021-03-10 18:00:30.180 INFO 15224 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6293abcc: startup date [Wed Mar 10 18:00:30 IST 2021]; root of context hierarchy
2021-03-10 18:00:30.505 INFO 15224 --- [ main] o.s.c.a.ConfigurationClassParser : Properties location [classpath:authentication.properties] not resolvable: class path resource [authentication.properties] cannot be opened because it does not exist
2021-03-10 18:00:30.505 INFO 15224 --- [ main] o.s.c.a.ConfigurationClassParser : Properties location [file:${external.config.dir.base}/application.properties] not resolvable: Could not resolve placeholder 'external.config.dir.base' in value 'file:${external.config.dir.base}/application.properties'
2021-03-10 18:00:30.506 INFO 15224 --- [ main] o.s.c.a.ConfigurationClassParser : Properties location [file:${external.config.dir.base}/config.properties] not resolvable: Could not resolve placeholder 'external.config.dir.base' in value 'file:${external.config.dir.base}/config.properties'
2021-03-10 18:00:30.506 INFO 15224 --- [ main] o.s.c.a.ConfigurationClassParser : Properties location [file:${external.config.dir.base}/authentication.properties] not resolvable: Could not resolve placeholder 'external.config.dir.base' in value 'file:${external.config.dir.base}/authentication.properties'
2021-03-10 18:00:31.046 ERROR 15224 --- [ main] o.s.boot.SpringApplication : Application run failed

java.lang.IllegalStateException: The following classes could not be excluded because they are not auto-configuration classes:
- com.azure.spring.autoconfigure.aad.AADAuthenticationFilterAutoConfiguration

at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.handleInvalidExcludes(AutoConfigurationImportSelector.java:200) ~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.checkExcludedClasses(AutoConfigurationImportSelector.java:185) ~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.selectImports(AutoConfigurationImportSelector.java:100) ~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.process(AutoConfigurationImportSelector.java:386) ~[spring-boot-autoconfigure-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:830) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:563) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:188) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at com.att.cdo.Application.main(Application.java:28) [classes/:na]

2021-03-10 18:00:31.051 INFO 15224 --- [ main] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6293abcc: startup date [Wed Mar 10 18:00:30 IST 2021]; root of context hierarchy

To Reproduce Steps to reproduce the behavior:

Create a spring boot project defining the below library dependancy,

    <dependency>
        <groupId>com.azure.spring</groupId>
        <artifactId>azure-spring-boot-starter-servicebus-jms</artifactId>
        <version>3.1.0</version>
    </dependency>

Write methods to send and JMSListener annotiation function for reciever for messages. Build and run the spring boot application.

Code Snippet Add the code snippet that causes the issue.

while using this dependency in pom,

    <dependency>
        <groupId>com.azure.spring</groupId>
        <artifactId>azure-spring-boot-starter-servicebus-jms</artifactId>
        <version>3.1.0</version>
    </dependency>

Expected behavior A clear and concise description of what you expected to happen.

Spring boot application should come up without this error and message send and recieve to the queue on service bus should happen.

Screenshots If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

Additional context Add any other context about the problem here.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

joshfree commented 3 years ago

@stliu @hemanttanwar can you please take a look?

zhichengliu12581 commented 3 years ago

Hi,@karthikmsc05

Thanks for your reporting.

Here is the sample azure-spring-boot-sample-servicebus-jms-topic and the sample azure-spring-boot-sample-servicebus-jms-queue

I'm thinking is it possible for you to create a minimal project or provide your pom.xml file so I can help to find the problem?

karthikmsc05 commented 3 years ago

Hi Team,

Thanks for your response. I have followed the same reference as you have given. Here is the POM of mine attached FYR.

pom.zip

zhichengliu12581 commented 3 years ago

Hi,@karthikmsc05

Please upgrade spring-boot-starter-parent's version. For azure-spring-boot-starter-servicebus-jms:3.1.0, the min version supported is spring-boot-starter-parent:2.2.11.RELEASE.

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.3</version>
    </parent>
karthikmsc05 commented 3 years ago

Hi Team,

I had updated the dependency as per you mentioned to the supported version and the build got succeeded.