cathrop

EslClient createPackage not working on MAC

0 votes
PackageId packageId = client.createPackage(superDuperPackage3); This works on Windows but when I run it on a MAC I get an EslException with a getLocalizedMessage() of "Could not create a new package" I am running it on macOS High Sierra (version 10.13.1)
Paul Cathro

Approved Answer

Reply to: EslClient createPackage not working on MAC

0 votes
Try sending file again
Paul Cathro

Reply to: EslClient createPackage not working on MAC

1 votes
Hi Paul, Can you post the complete error message?
Haris Haidary OneSpan Technical Consultant

Reply to: EslClient createPackage not working on MAC

0 votes
Haris, This is the error I am getting: Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:769) at com.silanis.esl.sdk.internal.RestClient.buildHttpClient(RestClient.java:243) at com.silanis.esl.sdk.internal.RestClient.execute(RestClient.java:176) at com.silanis.esl.sdk.internal.RestClient.post(RestClient.java:105) at com.silanis.esl.sdk.service.PackageService.createPackage(PackageService.java:50) at com.silanis.esl.sdk.EslClient.createPackage(EslClient.java:266) at eSignature.TextAnchor.main(TextAnchor.java:79) I have attached my Java code.
Paul Cathro

Reply to: EslClient createPackage not working on MAC

0 votes
Won't let me send a file so here is the code: package com.esignlive.example; import static com.silanis.esl.sdk.builder.DocumentBuilder.newDocumentWithName; import static com.silanis.esl.sdk.builder.PackageBuilder.newPackageNamed; import static com.silanis.esl.sdk.builder.SignatureBuilder.signatureFor; import static com.silanis.esl.sdk.builder.SignerBuilder.newSignerWithEmail; import java.io.PrintStream; import java.util.Date; import com.silanis.esl.sdk.DocumentPackage; import com.silanis.esl.sdk.EslClient; import com.silanis.esl.sdk.EslException; import com.silanis.esl.sdk.PackageId; import com.silanis.esl.sdk.TextAnchorPosition; import com.silanis.esl.sdk.builder.TextAnchorBuilder; import com.silanis.esl.sdk.internal.EslServerException; public class TextAnchor { private static final PrintStream o = System.out; //replace api_key placeholder with your own value private static final String API_KEY = "TmlBSGdOWENQQnNOOkZacDRWNEZiY2UwQg=="; public static final String API_URL = "https://sandbox.esignlive.com/api"; public static String clientEmail = null, clientLN = null, clientFN = null; public static String contrEmail = null, contrLN = null, contrFN = null; public TextAnchor(String clem, String clln, String clfn, String coem, String coln, String cofn) { clientEmail = clem; clientLN = clln; clientFN = clfn; contrEmail = coem; contrLN = coln; contrFN = cofn; } public static void main(String[] args) { try { new TextAnchor("[email protected]", "Eldred", "Mike", "[email protected]", "Cathro", "Paul"); //clientEmail = "[email protected]"; o.println("Client Email\t\t=\t" + clientEmail); o.println("Client First Name\t=\t" + clientFN); o.println("Client Last Name\t=\t" + clientLN); o.println("Contractor Email\t\t=\t" + contrEmail); o.println("Contractor First Name\t=\t" + contrFN); o.println("Contractor Last Name\t=\t" + contrLN); EslClient client = new EslClient(API_KEY, API_URL); //DocumentPackage superDuperPackage3 = newPackageNamed("02/02/2017 HCS WIN Comm") DocumentPackage superDuperPackage3 = newPackageNamed("Text Anchor Extraction Example Java SDK") .expiresAt( DateUtil.addDays(new Date(), 90) ) .withSigner(newSignerWithEmail(clientEmail) .withFirstName(clientFN) .withLastName(clientLN) .withEmailMessage("This is an example of adding custom text to the e-Signature email-Client\r\n\r\nWhatcha think Mike????") //.withCustomId("client") .signingOrder(2)) .withSigner(newSignerWithEmail(contrEmail) .withFirstName(contrFN) .withLastName(contrLN) .withEmailMessage("This is an example of adding custom text to the e-Signature email-IBM") //.withCustomId("contractor") .signingOrder(1)) //.withDocument(newDocumentWithName("02/02/2017 HCS WIN Comm") .withDocument(newDocumentWithName("Sample Contract") .withId("CustDocID00001") .fromFile("/Users/cathrop/Documents/ITSEXPPRUSME68S93115CLETTER.pdf") //.fromFile("C:\\$User\\GTS\\ITS Express\\e-signature\\cleaning_contract.pdf") //.fromFile("C:\\$User\\GTS\\ITS Express\\e-signature\\ITSEXPPRUSME68S93115CLETTER.pdf") .enableExtraction() .withSignature(signatureFor(clientEmail) .withPositionAnchor(TextAnchorBuilder.newTextAnchor("Authorized signature-Client") .atPosition(TextAnchorPosition.TOPLEFT) .withSize(150, 40) .withOffset(0, -50) .withCharacter(0) .withOccurence(0))) .withSignature(signatureFor(contrEmail) .withPositionAnchor(TextAnchorBuilder.newTextAnchor("Authorized signature-IBM") .atPosition(TextAnchorPosition.TOPLEFT) .withSize(150, 40) .withOffset(0, -50) .withCharacter(0) .withOccurence(0)))) .build(); PackageId packageId = client.createPackage(superDuperPackage3); o.println("packageId\t=\t" + packageId); // Send the package to be signed by the participants client.sendPackage(packageId); } catch (EslServerException eslServerException) { getEslServerException(eslServerException); } catch (EslException eslException) { getEslException(eslException); } catch (Exception ex) { getException(ex); } finally { getFinally(); } } private static void getException(Exception ex) { o.println("Caught a: " + ex.getClass().getName()); o.println("Message: " + ex.getMessage()); o.println("Stacktrace follows:....."); ex.printStackTrace(o); } private static void getFinally() { try { System.gc(); } catch (Exception e) { e.printStackTrace(o); } } private static void getEslServerException(EslServerException eslServerException) { // The request was refused by the server for some reason... o.println(eslServerException.getLocalizedMessage()); o.println(eslServerException.getServerError().getCode().toString()); o.println(eslServerException.getServerError().getMessage()); o.println(eslServerException.getServerError().getTechnical()); } private static void getEslException(EslException eslException) { o.println(eslException.getLocalizedMessage()); o.println(eslException.getCause().getMessage()); o.println(eslException.getMessage()); } }
Paul Cathro

Reply to: EslClient createPackage not working on MAC

0 votes
It seems like a compatibility version of the httpclient. Are using the latest SDK (11.8) and JDK (1.8)?
Haris Haidary OneSpan Technical Consultant

Reply to: EslClient createPackage not working on MAC

0 votes
Am at JDK 1.8 and was using SDK 11.5 (sdk-11.5-jar-with-dependencies) so downloaded 11.8 (sdk-11.8-jar-with-dependencies) and added it to my Buildpath (using Eclipse). Still get the same error: Exception in thread “main” java.lang.NoSuchFieldError: INSTANCE at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:769) at com.silanis.esl.sdk.internal.RestClient.buildHttpClient(RestClient.java:243) at com.silanis.esl.sdk.internal.RestClient.execute(RestClient.java:176) at com.silanis.esl.sdk.internal.RestClient.post(RestClient.java:105) at com.silanis.esl.sdk.service.PackageService.createPackage(PackageService.java:50) at com.silanis.esl.sdk.EslClient.createPackage(EslClient.java:266) at eSignature.TextAnchor.main(TextAnchor.java:79)
Paul Cathro

Reply to: EslClient createPackage not working on MAC

0 votes
You may want to look at this: https://stackoverflow.com/questions/21864521/java-lang-nosuchfielderror-org-apache-http-message-basiclineformatter-instance Make sure that you don't have another version of httpclient defined on the classpath. If you do, you'll need to remove it.
Haris Haidary OneSpan Technical Consultant

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off