Expected behavior
If com.microsoft.azure:applicationinsights-spring-boot-starter:1.1.2 is included in the project as Maven dependency and bundled with the WAR, the application should start up.
Actual behavior
The application throws an exception at startup.
java.lang.SecurityException: class "com.microsoft.applicationinsights.internal.config.WebReflectionUtils"'s signer information does not match signer information of other classes in the same package
To Reproduce
- Include com.microsoft.azure:applicationinsights-spring-boot-starter:1.1.2 as a Maven dependency in the project
- Build a WAR which bundles com.microsoft.azure:applicationinsights-spring-boot-starter:1.1.2
- Deploy on Azure WebApp Service with JRE11
System information
Please provide the following information:
- SDK Version:
- OS type and version: Azure Windows WebApp Service
- Application Server type and version (if applicable): Tomcat 9 (Auto-Update)
- Application Runtime: Java 11 (Auto-Update)
- Using spring-boot: yes
- Additional relevant libraries (with version, if applicable):
- com.microsoft.azure:applicationinsights-web:2.3.1
- com.microsoft.azure:applicationinsights-core:2.3.1
Root Cause
com.microsoft.azure:applicationinsights-web:2.3.1 is packaged and deployed to Maven Central as a fat-jar.
The fat-jar contains also the classes of com.microsoft.azure:applicationinsights-core:2.3.1, but applicationinsights-core is declared in the scope 'compile' in it's POM, which prompts the maven-war-plugin to bundle applicationinsights-core additionally to applicationinsights-web in the resulting WAR.
Because of this the classes of applicationinsights-core are duplicated on the classpath.
Proposed Solution
Do not deploy the fat-jar of applicationinsights-web to Maven Central, but the standard Jar instead.
Workaround
Declare applicationinsights-core as 'provided' in the dependency management section of the project POM.
Expected behavior
If com.microsoft.azure:applicationinsights-spring-boot-starter:1.1.2 is included in the project as Maven dependency and bundled with the WAR, the application should start up.
Actual behavior
The application throws an exception at startup.
To Reproduce
System information
Please provide the following information:
Root Cause
com.microsoft.azure:applicationinsights-web:2.3.1 is packaged and deployed to Maven Central as a fat-jar.
The fat-jar contains also the classes of com.microsoft.azure:applicationinsights-core:2.3.1, but applicationinsights-core is declared in the scope 'compile' in it's POM, which prompts the maven-war-plugin to bundle applicationinsights-core additionally to applicationinsights-web in the resulting WAR.
Because of this the classes of applicationinsights-core are duplicated on the classpath.
Proposed Solution
Do not deploy the fat-jar of applicationinsights-web to Maven Central, but the standard Jar instead.
Workaround
Declare applicationinsights-core as 'provided' in the dependency management section of the project POM.