title: Getting error after upgrading spring boot to 2.3.8 -Caused by: java.lang.ClassNotFoundException: org.springframework.data.mongodb.MongoDatabaseFactory
body: <p>I had upgraded spring boot to 2.3.8 and now while running the application am getting the following error and the service is not starting.</p>
  <pre><code>Caused by: java.lang.ClassNotFoundException: org.springframework.data.mongodb.MongoDatabaseFactory
      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:348)
      at org.springframework.util.ClassUtils.forName(ClassUtils.java:284)
      at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:324)
      ... 23 common frames omitted
  </code></pre>
  <p>Following are the mongodb related dependencies am using:</p>
  <pre><code>implementation &quot;org.springframework.boot:spring-boot-starter-data-mongodb:2.3.0.RELEASE&quot;
  implementation &quot;org.mongodb:mongo-java-driver:3.12.8&quot;
  </code></pre>
  <hr />
  <h2>UPDATE</h2>
  <p>If am adding the following dependency then the application starts but it fails while doing an insert operation using CRUD repositories:</p>
  <pre><code>implementation &quot;org.springframework.data:spring-data-mongodb:3.0.0.RELEASE&quot;
  </code></pre>
  <p>Error:</p>
  <pre><code>org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.mongodb.client.MongoCollection.insertOne(Ljava/lang/Object;)Lcom/mongodb/client/result/InsertOneResult;
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
      at com.davinta.commons.util.service.filter.GatewayAuthenticationTokenFilter.doFilter(GatewayAuthenticationTokenFilter.java:89)
  </code></pre>