BrainTree/Backendless exception

Hello
I am using ServiceAPI to do integration with BrainTree. I made a sample call

public class PaymentService implements IBackendlessService {
private static String getClientToken() {
BraintreeGateway gateway = new BraintreeGateway(
 Environment.SANDBOX,
 "merchantId",
 "publicKey",
"privateKey"
 );

 
  public String getClientToken() {
        return gateway.clientToken().generate();
  }
 }

I keep getting the exception below

{
    "code": 0,
    "message": "Type:\"java.lang.ExceptionInInitializerError\", Description:\"exception during method invocation\", ExceptionClass:\"ServiceException\"  {Msg:\"none\", Cause:\"none\"}",
    "errorData": {}
}

Although I tried another method that just returns a dummy string and I got that so I know the service is connected.

I ran the above code locally btw (ie Eclipse with a test function) and I was able to obtain the client key correctly. Therefore, this exception only happens when deployed on Backendless.

Can you please assist? My Java version is 11
Thank you

Hi @snakeeyes

Can you please provide the valid code sample so we can reproduce the issue?

Best Regards,
Maksym

@Maksym_Khobotin
Please see attached Java file as well as the library by Brain tree that is needed
com.zip (1004 Bytes) braintree-java-3.1.0.zip (419.7 KB)

Thank you!

Hi @snakeeyes,

Thanks for the code snippet.
An internal ticket BKNDLSS-22973 has been created to resolve this. We’ll notify you on the results here as soon as possible.

Regards,
Stanislaw

Hello Any update on this?

Hi @snakeeyes!

Sorry for inconvenience. Unfortunatelly we still working on a solution. We let you know when fix will be availalbe on production environment.

Regards, Andriy

Hello @Andriy_Konoz , any news with this issue? It does not allow integration with BrainTree and it is blocking our launch for the past month
Please update me
Thanks

I checked the status of the ticket and it shows that it hasn’t been resolved yet. While the team is working on it, I wanted to ask you to help us out. Have you checked if the method is working when running the service in the CodeRunner debug mode?

Also, could you please add the body of the method into a try/catch block and catch Throwable? When you catch the exception, try logging it so we can get more details.

Regards,
Mark

Thanks Mark. The same issue happens with debug mode ( actually Ididn’t get to deploy it because it kept happening in debug).
I added a catch block and used remote debugger of eclipse but the exception does not get caught. It seems it just terminates the thread. However I was able to extract that from the response

400 - Type:“java.lang.NoClassDefFoundError”, Description:“Could not initialize class java.util.logging.LogRecord$CallerFinder”, ExceptionClass:“ServiceException” {Msg:“none”, Cause:“none”}

Not sure if it means anything. If I run the code locally (like completely locally without code runner) then the call is made successfully and no issues. I attached a zip file to one of my messages below so you can just run it and see the behaviour
Thank you. Let me know if I can help further

Something tells me it is either a missing dependency or a config file. What jars do you have in the `/lib" directory of coderunner?

Hmm it seems the exception happens at the generate() call though
The Jars in the lib folder are
backendless.jar
braintree-java-3.1.0.jar
servlet-api-2.5.jar

Hello @snakeeyes

We made a fix.
Please check if it works for you.
Please write about the result.

@Volodymyr_Ialovyi Great news it works!!!
I downloaded a new project template which has the new backendless.jar that has your fix likely. I was able to deploy it in debug mode and get results
Thank you for the fix