Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4438

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

    XMLWordPrintableJSON

Details

    • Icon: Question Question
    • Resolution: Gone away
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • Not Needed

    Description

      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

      Attachments

        Activity

          People

            jeff.yemin@mongodb.com Jeffrey Yemin
            sanket@yopmail.com Sanket Chauhan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: