Azure / Azure/azure-documentdb-java

Document DB library needs to use Shade plugin to prevent class path versioning issues

Offen
#90 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
51
Forks
52
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Currently the Document DB library doesn't use the Maven Shade plugin. This plugin needs to be used to ensure that all dependencies are repackaged in a custom Microsoft namespace. This will help to ensure that usage of the Document DB library doesn't cause class path conflict issues (e.g. 'class path hell') where this SDK is used in combination with other libraries using similar, but different versions of dependencies.

Today, this class path conflict issue exists when using the Document DB SDK in the same app as the App Insights SDK. The problem is that both of these SDKs use different versions of underlying the org.apache.commons:commons-lang3 library. As a result, when you attempt to run the app, it fails at runtime with this type of exception:

Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.commons.lang3.reflect.FieldUtils.getFieldsListWithAnnotation(Ljava/lang/Class;Ljava/lang/Class;)Ljava/util/List.

The AI team is addressing this issue by updating the AI SDK to use the gradle shadow plugin. The Document DB SDK needs to do something similar by using the Maven Shade plugin (also, notice that the parent POM.xml for the Azure Mgmt libraries (com.microsoft.azure) uses this plugin already.

Here's the dependency tree that shows the conflict in greater detail:
NFO] +- **com.microsoft.azure:azure-documentdb-spring-boot-starter**:jar:0.1.7:compile
[INFO] | +- com.microsoft.azure:azure-documentdb-spring-boot-autoconfigure:jar:0.1.7:compile
[INFO] | | +- com.microsoft.azure:azure-documentdb:jar:1.13.0:compile
[INFO] | | | +- (com.fasterxml.jackson.core:jackson-databind:jar:2.8.8:compile - version managed from 2.8.3; omitted for duplicate)
[INFO] | | | +- org.json:json:jar:20140107:compile
**[INFO] | | | +- (org.apache.commons:commons-lang3:jar:3.5:compile - omitted for conflict with 3.1)**
[INFO] | | | +- (org.apache.httpcomponents:httpclient:jar:4.5.3:compile - version managed from 4.5.2; omitted for duplicate)
[INFO] | | | +- (org.apache.httpcomponents:httpcore:jar:4.4.6:compile - omitted for duplicate)
[INFO] | | | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | | +- (com.microsoft.azure:spring-data-azure-documentdb:jar:0.1.7:compile - omitted for duplicate)
[INFO] | | +- com.microsoft.azure:azure-spring-common:jar:0.1.7:compile
[INFO] | | \- org.springframework.boot:spring-boot-starter-validation:jar:1.5.4.RELEASE:compile
[INFO] | | +- (org.springframework.boot:spring-boot-starter:jar:1.5.4.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.15:compile - omitted for duplicate)
[INFO] | | \- (org.hibernate:hibernate-validator:jar:5.3.5.Final:compile - omitted for duplicate)
[INFO] | \- com.microsoft.azure:spring-data-azure-documentdb:jar:0.1.7:compile
[INFO] | +- (org.springframework:spring-core:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-tx:jar:4.3.9.RELEASE:compile
[INFO] | | +- (org.springframework:spring-beans:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | | \- (org.springframework:spring-core:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.13.4.RELEASE:compile
[INFO] | | +- (org.springframework:spring-core:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.25:compile - version managed from 1.7.6; omitted for duplicate)
[INFO] | | \- (org.slf4j:jcl-over-slf4j:jar:1.7.25:runtime - omitted for duplicate)
[INFO] | +- (org.springframework:spring-expression:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | +- (com.microsoft.azure:azure-spring-common:jar:0.1.7:compile - omitted for duplicate)
[INFO] | +- (com.microsoft.azure:azure-documentdb:jar:1.13.0:compile - omitted for duplicate)
[INFO] | \- com.google.code.gson:gson:jar:2.8.0:compile
**[INFO] \- com.microsoft.azure:applicationinsights-web**:jar:1.0.10:compile
[INFO] +- com.microsoft.azure:applicationinsights-core:jar:1.0.10:compile
[INFO] | +- eu.infomas:annotation-detector:jar:3.0.4:compile
[INFO] | +- commons-io:commons-io:jar:2.4:compile
[INFO] | +- (org.apache.commons:commons-lang3:jar:3.1:compile - omitted for duplicate)
[INFO] | +- (org.apache.httpcomponents:httpclient:jar:4.5.3:compile - version managed from 4.5.2; omitted for duplicate)
[INFO] | \- com.google.guava:guava:jar:12.0.1:compile
[INFO] | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
**[INFO] +- org.apache.commons:commons-lang3:jar:3.1:compile**
[INFO] \- org.apache.httpcomponents:httpclient:jar:4.5.3:compile
[INFO] +- org.apache.httpcomponents:httpcore:jar:4.4.6:compile
[INFO] \- commons-codec:commons-codec:jar:1.10:compile (version managed from 1.9)

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit der übergeordneten POM.xml, die von den Azure management libraries verwendet wird, und der Maven-Paketierungskonfiguration des Document DB SDK. Überprüfen Sie anschließend den im Issue gezeigten Abhängigkeitsbaum zusammen mit dem Gradle Shadow-Ansatz des App Insights SDK. Die Aufgabe ist abgeschlossen, wenn das paketierte Document DB SDK seine Abhängigkeiten unter einem Microsoft-Namespace isoliert und bei der Verwendung mit App Insights nicht mehr den gemeldeten commons-lang3 NoSuchMethodError erzeugt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
build-system
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.