Skip to content

Commit a3c6c92

Browse files
authored
Merge pull request #69220 from moderakh/patch-28
Dependency Conflict Issues workaround
2 parents 55b553e + d88a357 commit a3c6c92

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

articles/cosmos-db/troubleshoot-java-async-sdk.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,40 @@ This failure is a server-side failure. It indicates that you consumed your provi
148148

149149
The Azure Cosmos DB emulator HTTPS certificate is self-signed. For the SDK to work with the emulator, import the emulator certificate to a Java TrustStore. For more information, see [Export Azure Cosmos DB emulator certificates](local-emulator-export-ssl-certificates.md).
150150

151+
### Dependency Conflict Issues
152+
153+
```console
154+
Exception in thread "main" java.lang.NoSuchMethodError: rx.Observable.toSingle()Lrx/Single;
155+
```
156+
157+
The above exception suggests you have a dependency on an older version of RxJava lib (e.g., 1.2.2). Our SDK relies on RxJava 1.3.8 which has APIs not available in earlier version of RxJava.
158+
159+
The workaround for such issuses is to identify which other dependency brings in RxJava-1.2.2 and exclude the transitive dependency on RxJava-1.2.2, and allow CosmosDB SDK bring the newer version.
160+
161+
To identify which library brings in RxJava-1.2.2 run the following command next to your project pom.xml file:
162+
```bash
163+
mvn dependency:tree
164+
```
165+
For more information, see the [maven dependency tree guide](https://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html).
166+
167+
Once you identify RxJava-1.2.2 is transitive dependency of which other dependency of your project, you can modify the dependency on that lib in your pom file and exclude RxJava transitive dependency it:
168+
169+
```xml
170+
<dependency>
171+
<groupId>${groupid-of-lib-which-brings-in-rxjava1.2.2}</groupId>
172+
<artifactId>${artifactId-of-lib-which-brings-in-rxjava1.2.2}</artifactId>
173+
<version>${version-of-lib-which-brings-in-rxjava1.2.2}</version>
174+
<exclusions>
175+
<exclusion>
176+
<groupId>io.reactivex</groupId>
177+
<artifactId>rxjava</artifactId>
178+
</exclusion>
179+
</exclusions>
180+
</dependency>
181+
```
182+
183+
For more information, see the [exclude transitive dependency guide](https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html).
184+
151185

152186
## <a name="enable-client-sice-logging"></a>Enable client SDK logging
153187

0 commit comments

Comments
 (0)