OCR ExecutionContext error in ThreadPool

New Here ,
Jul 28, 2020 Jul 28, 2020

Copy link to clipboard

Copied

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:

Screenshot from 2020-07-28 15-32-24.png

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

TOPICS
How to , PDF Embed API , PDF Services API

Views

106

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 19, 2020 Oct 19, 2020

Copy link to clipboard

Copied

LATEST

@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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines