title: java.lang.NoClassDefFoundError error when running my project
body: <p>I have been struggling to get this to work and I think i can use some help. I am working on a Java project where the pom.xml has a bunch of dependencies some of which are themselves indirectly dependent on this jar:
  <code>com.sun.jersey:jersey-core:1.17.1</code> like this:</p>
  
  <pre><code>&lt;dependency&gt;
  &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
  &lt;artifactId&gt;jersey-client&lt;/artifactId&gt;
  &lt;version&gt;1.0.1&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>And I need this particular jar in my pom because I want to use the new features in jax-rs api:
  <code>javax.ws.rs:javax.ws.rs-api:2.0</code>.The problem is when I build my project I get this error:</p>
  
  <pre><code>Found duplicate classes in [com.sun.jersey:jersey-core:1.17.1,javax.ws.rs:javax.ws.rs-api:2.0] :
  [WARNING]   javax.ws.rs.ApplicationPath
  [WARNING]   javax.ws.rs.Consumes
  [WARNING]   javax.ws.rs.CookieParam 
  [WARNING]   javax.ws.rs.DELETE
  [WARNING]   javax.ws.rs.DefaultValue
  [WARNING]   javax.ws.rs.Encoded
  [WARNING]   javax.ws.rs.FormParam
  [WARNING]   javax.ws.rs.GET
  [WARNING]   javax.ws.rs.HEAD
  [WARNING]   javax.ws.rs.HeaderParam
  ...
  ..
  </code></pre>
  
  <p>I tried to fix this by excluding <code>com.sun.jersey:jersey-core:1.17.1</code> from dependencies which were including it by checking the dependency tree. </p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
    &lt;artifactId&gt;jersey-client&lt;/artifactId&gt;
    &lt;version&gt;1.0.1&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
    &lt;exclusions&gt;
      &lt;exclusion&gt;
        &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
        &lt;artifactId&gt;jersey-core&lt;/artifactId&gt;
      &lt;/exclusion&gt;
    &lt;/exclusions&gt;
  &lt;/dependency&gt; 
  </code></pre>
  
  <p>Now the project builds fine but when I try to run it I get this error:</p>
  
  <pre><code>    java.lang.NoClassDefFoundError: com/sun/jersey/core/util/FeaturesAndProperties
  at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.7.0_51]
  at java.lang.Class.privateGetDeclaredMethods(Class.java:2531) ~[na:1.7.0_51]
  at java.lang.Class.getDeclaredMethods(Class.java:1855) ~[na:1.7.0_51]
  at com.google.inject.internal.ProviderMethodsModule.getProviderMethods
      (ProviderMethodsModule.java:81) ~[guice-3.0.jar:na]
  at com.google.inject.internal.ProviderMethodsModule.configure
      (ProviderMethodsModule.java:73) ~[guice-3.0.jar:na]
  at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223) 
      ~[guice-3.0.jar:na]
  at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:232)
      ~[guice-3.0.jar:na]
  at com.google.inject.spi.Elements.getElements(Elements.java:101) ~[guice-3.0.jar:na]
  at com.google.inject.spi.Elements.getElements(Elements.java:92) ~[guice-3.0.jar:na]
  </code></pre>
  
  <p>It seems like jersey core was needed but how do I get around this problem?</p>