title: MongoDB with java Exception in thread "main" java.lang.NoClassDefFoundError: org/bson/conversions/Bson
body: <p>When I execute mycode from intelliJ Idea it works fine but when I run the jar on my server it throws the below error. I am using  'org.mongodb:mongodb-driver:3.4.1' version.</p>
  
  <pre><code> Exception in thread "main" java.lang.NoClassDefFoundError: org/bson/conversions/Bson
          at com.myapp.server.mongo.MongoDbHandler.prepareMongoDb(MongoDbHandler.java:68)
          at com.myapp.server.mongo.MongoDbHandler.&lt;init&gt;(MongoDbHandler.java:22)
          at com.myapp.server.Client.main(Client.java:167)
  Caused by: java.lang.ClassNotFoundException: org.bson.conversions.Bson
          at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
          at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
          ... 3 more
  </code></pre>