title: NoClassDefFoundError for MongoClient in cloud9
body: <p>I'm using maven to create a jar that i can launch.</p>
  
  <p>So i do : <code>mvn clean install</code> and i get the jar.</p>
  
  <p>When i do : <code>java -jar target/ProjetMRS-0.0.1-SNAPSHOT.jar</code> i got this error below :</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: com/mongodb/MongoClient                                                       
          at iut.nantes.Projet.service.ServicePersonne.&lt;init&gt;(ServicePersonne.java:21)                                                  
          at iut.nantes.projetMRS.Api.&lt;clinit&gt;(Api.java:21)                                                                                
  Caused by: java.lang.ClassNotFoundException: com.mongodb.MongoClient                                                                     
          at java.net.URLClassLoader.findClass(URLClassLoader.java:381)                                                                    
          at java.lang.ClassLoader.loadClass(ClassLoader.java:424)                                                                         
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)                                                                 
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)                                                                         
          ... 2 more
  </code></pre>
  
  <p>And when i look at the file all import are up-to-date :</p>
  
  <pre><code>package iut.nantes.projetMRS.service;
  
  import java.util.Calendar;
  import java.util.Date;
  import java.util.List;
  
  import org.bson.types.ObjectId;
  import org.mongodb.morphia.Datastore;
  import org.mongodb.morphia.Morphia;
  import org.mongodb.morphia.query.Query;
  import org.mongodb.morphia.query.UpdateOperations;
  
  import com.mongodb.MongoClient;
  import iut.nantes.projetMRS.entity.EntityPersonne;
  
  public class ServicePersonne {
      /*Error here ==&gt;*/ MongoClient client = new MongoClient("localhost", 27017); //connect to mongodb
  [...]
  </code></pre>
  
  <p>And the last thing that's very strange is that when i launch my application on my own computer, every thing works fine, i got 0 error and MongoClient is found.</p>
  
  <p>I've looked here : <code>https://stackoverflow.com/questions/45045681/how-do-i-fix-a-noclassdeffounderror-for-mongoclient-in-my-sparkjava-app</code> but nobody answered him</p>
  
  <p>I've found some answer but none of them worked for my case.</p>
  
  <p>Below i show you my pom file with all dependencies up-to-date too :</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;iut.nantes&lt;/groupId&gt;
      &lt;artifactId&gt;projetMRS&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;projetMRS&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.0.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                              &lt;mainClass&gt;iut.nantes.projetMRS.Api&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;3.8.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
              &lt;artifactId&gt;mongo-java-driver&lt;/artifactId&gt;
              &lt;version&gt;3.6.3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
              &lt;artifactId&gt;mongodb-driver&lt;/artifactId&gt;
              &lt;version&gt;3.6.3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
              &lt;artifactId&gt;mongodb-driver-core&lt;/artifactId&gt;
              &lt;version&gt;3.6.3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sparkjava&lt;/groupId&gt;
              &lt;artifactId&gt;spark-core&lt;/artifactId&gt;
              &lt;version&gt;2.3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
              &lt;artifactId&gt;bson&lt;/artifactId&gt;
              &lt;version&gt;3.6.3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.mongodb.morphia&lt;/groupId&gt;
              &lt;artifactId&gt;morphia&lt;/artifactId&gt;
              &lt;version&gt;1.3.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
              &lt;artifactId&gt;gson&lt;/artifactId&gt;
              &lt;version&gt;2.3.1&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>