title: java.lang.NoClassDefFoundError for com/migcomponents/migbase64/Base64
body: <p>I am using DocuSign java client first time. I am create custom template for my pdf file. I am using DocuSign APIs. But facing following error:</p>
  
  <pre><code>javax.servlet.ServletException: java.lang.NoClassDefFoundError: 
  com/migcomponents/migbase64/Base64
  
  
  com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420)
      com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
      com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
  </code></pre>
  
  <p>I have created REST API and in that API i am trying to use createTemplate code but facing above issue.</p>
  
  <p>I have imported all required jars in my project using maven. All jars are also present in my classpath. It seems at compile time all jar are found but at runtime not able to find the jars. </p>
  
  <pre><code>@Path("/template")
  public class CreateTemplate {
  
  
  private static final String UserName = "xyz.abc@gmail.com";
  private static final String UserId = "fcc5726c-cd73-4844-b580-40bbbe6ca126";
  private static final String IntegratorKey = "ae30ea4e-3959-4d1c-b867-fcb57d2dc4df";
  private static final String IntegratorKeyImplicit = "68c1711f-8b19-47b1-888f-b49b4211d831";
  //private static final String ClientSecret = "b4dccdbe-232f-46cc-96c5-b2f0f7448f8f";
  private static final String RedirectURI = "https://www.docusign.com/api";
  
  private static final String BaseUrl = "https://demo.docusign.net/restapi";
  //private static final String OAuthBaseUrl = "account-d.docusign.com";
  private static final String privateKeyFullPath = System.getProperty("user.dir") + "/src/test/keys/docusign_private_key.txt";
  
  private static final String SignTest1File = "C:\\Users\\xyz\\Documents\\testDocuments\\SignTest1.pdf";
  //private static final String TemplateId = "cf2a46c2-8d6e-4258-9d62-752547b1a419";
  private String[] envelopeIds = new String[0];
  TemplateSummary templateSummary;
  
  @GET
  @Path("/createTemplate")
  @Produces("text/plain")
  public TemplateSummary createTemplate() {
  
      System.out.println("\nCreateTemplateTest:\n" + "===========================================");
      byte[] fileBytes = null;
      File f;
      try {
          // String currentDir = new java.io.File(".").getCononicalPath();
  
          String currentDir = System.getProperty("user.dir");
  
          java.nio.file.Path path = Paths.get(SignTest1File);
          fileBytes = Files.readAllBytes(path);
  
          f = new File(path.toString());
          //Assert.assertTrue(f.length() &gt; 0);
          System.out.println("f.length()--&gt;"+f.length());
      } catch (IOException ioExcp) {
          //Assert.assertEquals(null, ioExcp);
          ioExcp.printStackTrace();
      }
  
      // create an envelope to be signed
  
      EnvelopeTemplate templateDef = new EnvelopeTemplate();
      templateDef.setEmailSubject("Please Sign my Java SDK Envelope");
      templateDef.setEmailBlurb("Hello, Please sign my Java SDK Envelope.");
  
      // add a document to the envelope
      Document doc = new Document();
      String base64Doc = Base64.encodeToString(fileBytes, false);
      //String base64Doc = Base64.encodeToString(str.getBytes("UTF-8"), false))
      doc.setDocumentBase64(base64Doc);
      doc.setName("TestFile.pdf");
      doc.setDocumentId("1");
  
      List&lt;Document&gt; docs = new ArrayList&lt;Document&gt;();
      docs.add(doc);
      templateDef.setDocuments(docs);
  
      // Add a recipient to sign the document
      Signer signer = new Signer();
      signer.setRoleName("Signer1");
      signer.setRecipientId("1");
  
      // Create a SignHere tab somewhere on the document for the signer to
      // sign
      SignHere signHere = new SignHere();
      signHere.setDocumentId("1");
      signHere.setPageNumber("1");
      signHere.setRecipientId("1");
      signHere.setXPosition("100");
      signHere.setYPosition("100");
      signHere.setScaleValue("0.5");
  
      List&lt;SignHere&gt; signHereTabs = new ArrayList&lt;SignHere&gt;();
      signHereTabs.add(signHere);
      Tabs tabs = new Tabs();
      tabs.setSignHereTabs(signHereTabs);
      signer.setTabs(tabs);
  
      templateDef.setRecipients(new Recipients());
      templateDef.getRecipients().setSigners(new ArrayList&lt;Signer&gt;());
      templateDef.getRecipients().getSigners().add(signer);
  
      EnvelopeTemplateDefinition envTemplateDef = new EnvelopeTemplateDefinition();
      envTemplateDef.setName("myTemplate");
      templateDef.setEnvelopeTemplateDefinition(envTemplateDef);
  
      ApiClient apiClient = new ApiClient(BaseUrl);
      //String currentDir = System.getProperty("user.dir");
  
      try {
          // IMPORTANT NOTE:
          // the first time you ask for a JWT access token, you should grant access by making the following call
          // get DocuSign OAuth authorization url:
          //String oauthLoginUrl = apiClient.getJWTUri(IntegratorKey, RedirectURI, OAuthBaseUrl);
          // open DocuSign OAuth authorization url in the browser, login and grant access
          //Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
          // END OF NOTE
  
          byte[] privateKeyBytes = null;
          try {
              privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
          } catch (IOException ioExcp) {
              //Assert.assertEquals(null, ioExcp);
              ioExcp.printStackTrace();
          }
          if (privateKeyBytes == null) return null;
  
          java.util.List&lt;String&gt; scopes = new ArrayList&lt;String&gt;();
          scopes.add(OAuth.Scope_SIGNATURE);
  
          OAuth.OAuthToken oAuthToken = apiClient.requestJWTUserToken(IntegratorKey, UserId, scopes, privateKeyBytes, 3600);
          //Assert.assertNotSame(null, oAuthToken);
          // now that the API client has an OAuth token, let's use it in all
          // DocuSign APIs
          apiClient.setAccessToken(oAuthToken.getAccessToken(), oAuthToken.getExpiresIn());
          UserInfo userInfo = apiClient.getUserInfo(oAuthToken.getAccessToken());
          /*Assert.assertNotSame(null, userInfo);
          Assert.assertNotNull(userInfo.getAccounts());
          Assert.assertTrue(userInfo.getAccounts().size() &gt; 0);
   */
          System.out.println("userInfo.getAccounts().size()--&gt;"+userInfo.getAccounts().size());
          System.out.println("UserInfo: " + userInfo);
          // parse first account's baseUrl
          // below code required for production, no effect in demo (same
          // domain)
          apiClient.setBasePath(userInfo.getAccounts().get(0).getBaseUri() + "/restapi");
          Configuration.setDefaultApiClient(apiClient);
          String accountId = userInfo.getAccounts().get(0).getAccountId();
  
          TemplatesApi templatesApi = new TemplatesApi();
          templateSummary = templatesApi.createTemplate(accountId, templateDef);
  
          //Assert.assertNotNull(templateSummary);
          //Assert.assertNotNull(templateSummary.getTemplateId());
  
          System.out.println("templateSummary--&gt;"+templateSummary);
          System.out.println("templateSummary.getTemplateId()--&gt;"+templateSummary.getTemplateId());
  
          //System.out.println("TemplateSummary: " + templateSummary);
  
      } catch (ApiException ex) {
          System.out.println("Exception: 123");
          ex.printStackTrace();
      } catch (Exception e) {
          //System.out.println("Exception: " + e.getLocalizedMessage());
          System.out.println("Exception: 234");
          e.printStackTrace();
      }
  
  
  
      return templateSummary;
  
  }
  }
  </code></pre>
  
  <p>I feel like I am facing missing runtime jar files.</p>