2

I am trying to use the Mongo scala client, but when I init the client I get the following exception:

java.lang.NoSuchMethodError: com.mongodb.MongoClientSettings.getUuidRepresentation()Lorg/bson/UuidRepresentation;

In my project, I also use Mongo java client for other purposes.

I saw this question and solution so I guess it is probably the same issue (libraries conflicts).

The problem is that I prefer to keep the design of 2 clients- one java and one scala (BTW, each client is for a different Mongo cluster).

I wonder how can I achieve that.

build.sbt:

"org.mongodb" % "mongo-java-driver" % "3.11.1",
"org.mongodb.scala" %% "mongo-scala-driver" % "2.9.0",

code:

val mongoClient: MongoClient = org.mongodb.scala.MongoClient(server)

Thanks a lot

5
  • Your referenced question link is broken. Commented Jun 30, 2020 at 12:01
  • mongodb.github.io/mongo-scala-driver says scala driver is merged into java driver, so you should be using the same driver versions for both? Commented Jun 30, 2020 at 12:08
  • Can't find org.mongodb.scala in the package org.mongodb, this is why I imported it. Commented Jun 30, 2020 at 13:49
  • what is server in your code sample? Commented Jul 1, 2020 at 7:20
  • A string, mongodb://<server_name>:<port> I don't think this is the problem. Commented Jul 2, 2020 at 8:40

1 Answer 1

1

Seems like there is no solution for having 2 clients. Eventually, I used one java client :(

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.