Running into java.lang.NoClassDefFoundError: class com.sun.jersey.core.header.MediaTypes while using


I am new to Docusign and trying to use the <a href="https://github.com/docusign/docusign-java-client" rel="nofollow">Java Client</a> However I run into the following error when trying to use code from the recipes -

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jersey.core.header.MediaTypes at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:182) at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:176) at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:162) at com.sun.jersey.api.client.Client.init(Client.java:343) at com.sun.jersey.api.client.Client.access$000(Client.java:119) at com.sun.jersey.api.client.Client$1.f(Client.java:192) at com.sun.jersey.api.client.Client$1.f(Client.java:188) at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193) at com.sun.jersey.api.client.Client.<init>(Client.java:188) at com.sun.jersey.api.client.Client.<init>(Client.java:160) at com.sun.jersey.api.client.Client.create(Client.java:673) at com.docusign.esign.client.ApiClient.getClient(ApiClient.java:671) at com.docusign.esign.client.ApiClient.getAPIResponse(ApiClient.java:429) at com.docusign.esign.client.ApiClient.invokeAPI(ApiClient.java:543) at com.docusign.esign.api.AuthenticationApi.login(AuthenticationApi.java:147)

The jars that I included to resolve some dependency issues are -

com.fasterxml.jackson.core/jars/jackson-annotations-2.4.2.jar com.fasterxml.jackson.core/jars/jackson-core-2.4.2.jar com.fasterxml.jackson.core/jars/jackson-databind-2.4.2.jar com.fasterxml.jackson.datatype/jars/jackson-datatype-joda-2.1.5.jar io.swagger/jars/swagger-annotations-1.5.4.jar com.sun.jersey.contribs/jars/jersey-multipart-1.18.jar com.sun.jersey/jars/jersey-bundle-1.19.jar com.brsanthu/jars/migbase64-2.2.jar com.docusign.esign/jars/com-docusign-esign-15.4.0.jar


You don't have jersey-core jar. You can download the jar from <a href="http://mvnrepository.com/artifact/com.sun.jersey/jersey-core/1.19" rel="nofollow">here</a>


Adding <strong>javax.ws.rs-api-2.0.1.jar</strong> resolved my NoClassDefFoundError. This jar does not get listed in the maven dependency tree. A Junit test for the com.sun.jersey.core.header.MediaTypes class as shown below helped me get a descriptive error message.

public class MediaTypesTest extends TestCase { public void testLoadClass() throws Exception { MediaTypes.getTypeWildCart(MediaType.MULTIPART_FORM_DATA_TYPE); } }


First of all welcome to DocuSign community! I am sorry to hear that you have dependency issues. I will glad to help you to fix it.

In order to make DocuSign Java developers life easier, we have published a brand new Maven package. Please go to this page and you will find all the information that you need, <strong>in order to get up and running with the Java client: <a href="http://mvnrepository.com/artifact/com.docusign/docusign-esign-java/2.0.0" rel="nofollow">http://mvnrepository.com/artifact/com.docusign/docusign-esign-java/2.0.0</a></strong>.

As you will see, the jersey-client and jersey-multipart version is <strong>1.18</strong>.

If you are using Pom, Gradle, or any other build system that supports remote package dependency resolving, then you can drop the packages that are in your lib folder, and use the Maven package. Your build management software (Pom or Gradle), will be able to resolve the dependencies automagically.

<ul><li>For Pom:</li> </ul>

<pre class="snippet-code-html lang-html prettyprint-override"><dependency> <groupId>com.docusign</groupId> <artifactId>docusign-esign-java</artifactId> <version>2.0.0</version> </dependency> <ul><li>For Gradle: 'com.docusign:docusign-esign-java:2.0.0'</li> </ul>

If you still have trouble, please let me know how you added the dependencies to your Java project and I will be glad to help.




  • @RepositoryRestResource's collectionResourceRel attribute not being obeyed
  • Could not write JSON: No serializer found for class net.i2p.crypto.eddsa.math.ed25519.Ed25519LittleE
  • Authentication with custom authenticator via Azure Mobile Services and cordova app
  • getting a “Caused by: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet” when starting
  • Play, Eclipse, Java generate project template
  • AWS Java SDK is taking old version of jackson jar
  • How to map json to object using spring boot [duplicate]
  • Mapping JSON to Java Object return null value
  • How to implement cascading DropDownList ASP.Net control? [closed]
  • Compilation error - package does not exist - Java
  • Dependency Injection - Choose DLL and class implementation at runtime through configuration file
  • How to Autowire repository interface from a different package using Spring Boot?
  • Alternate (Free) to AOP PostSharp for method tracing (and exception)
  • Android Studio: Link of external JAR in a multi modules project
  • Specify ivy configuration in gradle dependency
  • Set Initial Value for Required attribute
  • iphone - Hide the annotation view in map view
  • FAILURE: Gradle Build failed with an exception
  • Install 3rd Party Libraries with Transitive Dependencies / Dependency Tree?
  • Can't get LogCat (Alcatel OneTouch Evolve)
  • Defining variable by logical subseting on time interval in data.table
  • Dependency Injection and Code Obfuscation
  • SCons libraries and sub-libraries
  • Bind drop down list with Dictionary
  • Cannot update firebase version [duplicate]
  • How can I include the Ivy dependency and none of its dependencies?
  • How to force Composer to download a local package?
  • PHP in userdir not working
  • VB.Net Double comparison after some additions
  • Partial specialization of a class template in derived class affects base class
  • How do you create a Fuseki SPARQL server using the Apache Jena Java API?
  • hibernate sets dirty flag (and issues update) even though client did not change value
  • JSR-330 support in Picocontainer : @Inject … @Named(\"xxx)
  • SonarQube: Cannot deactivate rule with missing quality profile
  • Implicit joins and Where in Doctrine - how?
  • How to generate and display a QR Code in ionic 2
  • Sonar maven jacoco code coverage for Multimodule project
  • Silverlight DependencyProperty.SetCurrentValue Equivalent
  • Atlas images wrong size on iPad iOS 9
  • Control modification in presentation layer