Mongo java driver upgrade from 3.12.1 to 4.2.3 throws method not found errors

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Gone away
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Hii
      We have java application based on mongo server 4.2 and component versions are as follows
      spring-boot 2.2.5.RELEASE
      spring-data-mongodb2.2.5.RELEASE
      mongo-java-driver3.12.1

      We had to update spring boot to 2.5.8 hence we made few changes to update dependencies as follow
      spring-boot2.5.8
      spring-starter-parent2.5.8
      spring-data-mongodb 3.2.3
      mongodb-driver-core 4.2.3

      As we were using newly added import com.mongodb.client.MongoClient;
      import com.mongodb.client.MongoClients; we updated to mongodb-driver-sync 4.2.3

      *We resolved all compilation error but on deployment we got errors like methos not found for *getSrvHost() on further debugging we found that old dependency mongo-java-driver 3.3.0 was already present in project

      We excluded that and above issue is resolved now no old dependency is present but still we are getting following error without using legacy API approach

      java.lang.NoClassDefFoundError: com/mongodb/MongoClient
      Caused by: java.lang.NoClassDefFoundError: com/mongodb/MongoClient

      We are completely stuck at this point

            Assignee:
            Jeffrey Yemin
            Reporter:
            Sanket Chauhan
            None
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: