skip to Main Content

I have been running MongoDB (5.0.7) for a number of years with Hibernate ORM & OGM. Currently using ‘org.mongodb:mongodb-driver-core:4.6.0‘. (2022.04.26)

Using WildFly 26.1.0.Final (Jakarta EE 8 Full) with OpenJDK 18.0.1. IntelliJ IDEA 2022.1, Gradle 7.4.2 & macOS Monterey 12.3.1.

I need to migrate to Jakarta 9. See "Hibernate OGM is not going to work with ORM 5.5 (the latest version requires ORM 5.3)." on:
How to use Hibernate ORM 5.5.x.Final with Jakarta 9 on wildfly-preview-25.0.0.Final

I am looking at using ODM ‘Morphia 2.2.6‘ (dev.morphia.morphia:morphia-core:2.2.6) and trying to run the ‘morphia/example/QuickTour.java’:

https://github.com/MorphiaOrg/morphia/blob/2.2.x/examples/src/test/java/dev/morphia/example/QuickTour.java

It compiles, but when I try & run it I get:

Exception in thread "main" java.lang.NoSuchMethodError: 'java.lang.String com.mongodb.connection.ClusterSettings.getDescription()'
    at com.mongodb.connection.DefaultClusterFactory.createCluster(DefaultClusterFactory.java:179)
    at com.mongodb.client.internal.MongoClientImpl.createCluster(MongoClientImpl.java:190)
    at com.mongodb.client.internal.MongoClientImpl.<init>(MongoClientImpl.java:57)
    at com.mongodb.client.MongoClients.create(MongoClients.java:112)
    at com.mongodb.client.MongoClients.create(MongoClients.java:99)
    at com.mongodb.client.MongoClients.create(MongoClients.java:83)
    at com.mongodb.client.MongoClients.create(MongoClients.java:40)
    at dev.morphia.example.QuickTour.main(QuickTour.java:23)

Have also tried with:

 final Datastore datastore = Morphia.createDatastore(MongoClients.create("mongodb://localhost:27017"), "morphia_example");

Any suggestions? TIA.

2

Answers


  1. Chosen as BEST ANSWER

    "Schoolboy error" - Didn't add to Gradle:

    "implementation group: "org.mongodb", name: "mongo-java-driver", version: "3.12.10"
    

    So IntelliJ 'run' failed. Apologies!


  2. What version of the driver are you using? 4.2.x is the earliest version currently being tested.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search