5 / 5
Oct 2024

So I recently tried to connect to my cluster via the kotlin driver in an android app. But when I try to start a connection (or use the library at all), I get this error:

java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/naming/directory/InitialDirContext; at com.mongodb.internal.dns.JndiDnsClient.createDnsDirContext(JndiDnsClient.java:73) (..stacktrace..) Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.naming.directory.InitialDirContext" on path: DexPathList[[zip file "/data/app/com.lucaperri.gima-gGprbMQgcl8fKcewyK1Gjg==/base.apk"],nativeLibraryDirectories=[/data/app/com.lucaperri.gima-gGprbMQgcl8fKcewyK1Gjg==/lib/arm64, /system/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]

Does anybody know on how to fix this issue? I am using org.mongodb:mongodb-driver-kotlin-coroutine:4.11.1

Hi, thanks for the response.

I have tried tried using the kotlin coroutine, realm aswell as both java drivers (sync and the stream.)
This issue still persists, through all libraries and all drivers.

I am not sure on what to do, since there’s is neither a documentation, nor a solution online.

9 months later

Hi Luca,
Do you know the solution to this issue? I’m experiencing the exact same problem.
Thank you