title: deleting from mongo in spring java
body: <p>I am trying to delete a document from mongoDB by using spring data in java</p>
  
  <p>here is my maven dependecies:</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
      &lt;artifactId&gt;spring-cloud-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;Brixton.SR1&lt;/version&gt;
      &lt;relativePath/&gt;
  &lt;/parent&gt;
  &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-mongodb&lt;/artifactId&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>I am using MongoRepository to define my repositries in java:</p>
  
  <pre><code>public interface FilesInfoRepository extends MongoRepository&lt;MyCollectionClass, String&gt; { ... }
  </code></pre>
  
  <p>here is the brief exception:</p>
  
  <pre><code>**java.lang.NoClassDefFoundError: com/mongodb/RemoveRequest**
  </code></pre>
  
  <p>and here is the full exception:</p>
  
  <pre><code> ERROR [[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: com/mongodb/RemoveRequest] with root cause java.lang.NoClassDefFoundError: com/mongodb/RemoveRequest
      at com.mongodb.DBCollectionImpl.remove(DBCollectionImpl.java:223) ~[mongo-java-driver-2.13.3.jar!/:na]
      at com.mongodb.DBCollectionImpl.remove(DBCollectionImpl.java:203) ~[mongo-java-driver-2.13.3.jar!/:na]
      at com.mongodb.DBCollection.remove(DBCollection.java:300) ~[mongo-java-driver-2.13.3.jar!/:na]
      at com.mongodb.DBCollection.remove(DBCollection.java:327) ~[mongo-java-driver-2.13.3.jar!/:na]
      at org.springframework.data.mongodb.core.MongoTemplate$13.doInCollection(MongoTemplate.java:1295) ~[spring-data-mongodb-1.8.4.RELEASE.jar!/:na]
      at org.springframework.data.mongodb.core.MongoTemplate$13.doInCollection(MongoTemplate.java:1279) ~[spring-data-mongodb-1.8.4.RELEASE.jar!/:na]
      at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:462) ~[spring-data-mongodb-1.8.4.RELEASE.jar!/:na]
      at org.springframework.data.mongodb.core.MongoTemplate.doRemove(MongoTemplate.java:1279) ~[spring-data-mongodb-1.8.4.RELEASE.jar!/:na]
      at org.springframework.data.mongodb.core.MongoTemplate.remove(MongoTemplate.java:1265) ~[spring-data-mongodb-1.8.4.RELEASE.jar!/:na]
      at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.delete(SimpleMongoRepository.java:155) ~[spring-data-mongodb-1.8.4.RELEASE.jar!/:na]
      at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.delete(SimpleMongoRepository.java:164) ~[spring-data-mongodb-1.8.4.RELEASE.jar!/:na]
      at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.delete(SimpleMongoRepository.java:176) ~[spring-data-mongodb-1.8.4.RELEASE.jar!/:na]
      at sun.reflect.GeneratedMethodAccessor254.invoke(Unknown Source) ~[na:na]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
      at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:483) ~[spring-data-commons-1.11.4.RELEASE.jar!/:na]
      at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:468) ~[spring-data-commons-1.11.4.RELEASE.jar!/:na]
  </code></pre>
  
  <p>my mongo is a replicaSet and is another datacenter, but I am sure that the connection is working well and other actions on mongo works well, just delete doesnot work.</p>
  
  <p>update:
  here is my full pom.xml:</p>
  
  <pre><code>&lt;parent&gt;
  &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
  &lt;artifactId&gt;spring-cloud-starter-parent&lt;/artifactId&gt;
  &lt;version&gt;Brixton.SR1&lt;/version&gt;
  &lt;relativePath/&gt;
  &lt;/parent&gt;
  &lt;dependencies&gt;
  &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-io&lt;/groupId&gt;
          &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
          &lt;version&gt;2.4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
          &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
          &lt;version&gt;1.3.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-mongodb&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-redis&lt;/artifactId&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.2.4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-test&lt;/artifactId&gt;
          &lt;version&gt;4.0.1.RELEASE&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
          &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
          &lt;version&gt;4.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;io.springfox&lt;/groupId&gt;
          &lt;artifactId&gt;springfox-swagger-ui&lt;/artifactId&gt;
          &lt;version&gt;2.4.0&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;io.springfox&lt;/groupId&gt;
          &lt;artifactId&gt;springfox-swagger2&lt;/artifactId&gt;
          &lt;version&gt;2.4.0&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>