Business Logic & Braintree integration - NoClassDefFoundError

Hello,
I’m experimenting with adding a Braintree integration into the Business Logic. So I wrote a simple ApiService:

public class PaymentService implements IBackendlessService {
 
 public String getClientToken() {
 BraintreeGateway gateway = new BraintreeGateway(
 Environment.SANDBOX,
 "<merchantId>",
 "<publicKey>",
 "<privateKey>"
 );
 return gateway.clientToken().generate();
 }
 public String getTestException() {
 return new BraintreeException("Exception").getMessage();
 }
}

Creating service from uploaded .jar file went without any errors.
However executing GET /ClientToken returns an error:
400 - Type:“java.lang.NoClassDefFoundError”, Description:“Could not initialize class sun.security.ssl.SSLContextImpl$DefaultSSLContext”, ExceptionClass:“ServiceException” {Msg:“none”, Cause:“none”}
Executing GET /TestException works fine.
I’ve tried this service in both - Backendles v3 and v4 - non of them worked.
Can you please suggest what can I do to fix this issue? Is this because there can be some network requests to Braintree API?
Regards,
Matt

Hi Matt,

The calls in 3.x and 4.0 fail for different reasons.

In 3.x you need to add the host which the library communicates with per the instructions at:
https://backendless.com/documentation/business-logic/java/bl_external_hosts.htm

In 4.0 there is currently a problem related to SSL initialization with CodeRunners running on our servers (it should work in the debug mode though).

Regards,
Mark