Skip to main content
Participant
July 28, 2020
Question

OCR ExecutionContext error in ThreadPool

  • July 28, 2020
  • 1 reply
  • 405 views

I am trying to run the OCR operation in a ThreadPool. My code looks like this:

 

 

ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(5);
executor.submit(() -> {
       Credentials credentials = Credentials.serviceAccountCredentialsBuilder()
                    .fromFile("/home/darvasr/dc-services-sdk-credentials.json")
                    .build();

      ExecutionContext executionContext = ExecutionContext.create(credentials);
      OCROperation ocrOperation = OCROperation.createNew();

 

 

But when the ExecutionContext instance gets created the run fails and exception occurs when the AuthenticatorFactory calls this:

 

 

return new JwtAuthenticator((ServiceAccountCredentials) credentials);

 

 

Detailed exception:

What could be the problem (Same happens when I run it without the ThreadPoolExecutor) ? The OCR-ing works in a separate project.

This topic has been closed for replies.

1 reply

Adobe Employee
October 19, 2020

@darvasr It seems to be that dependencies are not loaded correctly. Could you please share the dependencies list which are added in the pom.xml to setup this project ?
JOSEException is part of nimbus-jose-jwt jar which is a dependency which should be automatically fetched as part of pdftools-sdk's dependencies. I think there might be some conflict with some other version jar which may result in this issue.