1

I get this error while executing the AWS Tetxtract API .

Exception in thread "main" java.lang.NoSuchMethodError: com.amazonaws.client.AwsSyncClientParams.getAdvancedConfig()Lcom/amazonaws/client/builder/AdvancedConfig; at com.amazonaws.services.textract.AmazonTextractClient.(AmazonTextractClient.java:149) at com.amazonaws.services.textract.AmazonTextractClient.(AmazonTextractClient.java:133) at com.amazonaws.services.textract.AmazonTextractClientBuilder.build(AmazonTextractClientBuilder.java:61) at com.amazonaws.services.textract.AmazonTextractClientBuilder.build(AmazonTextractClientBuilder.java:27) at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46) at com.tr.fundamental.s3FileUploader.AnalyzeDocument.main(AnalyzeDocument.java:177)

I have downloaded the latest Textract jar and included in my build path . I do not get any compilation error ,but when i run i get this error at this point

  // Call AnalyzeDocument 
        EndpointConfiguration endpoint = new EndpointConfiguration("https://textract.us-east-1.amazonaws.com", "us-east-1");
        AmazonTextract client = AmazonTextractClientBuilder.standard().withEndpointConfiguration(endpoint).build();

My credential and all are correct and able to connect to S3 as well. I am not sure what i am missing . Please help

Sudarshan kumar
  • 1,503
  • 4
  • 36
  • 83

4 Answers4

1

A possible issue is that you are using difference artefact versions your aws libraries.

In case you are using Maven, have a look on: https://stackoverflow.com/a/55330900/2353294

Fabio Farath
  • 489
  • 6
  • 12
  • Hi there, I see you are knowledgeable on this topic. Could you please help with : https://stackoverflow.com/questions/62499160/aws-textract-key-value-pair-java-thread-main-java-lang-nullpointerexception – Daniel Xav De Oliveira Jun 21 '20 at 13:27
0

Ok let me answer my question . So using Default client solved my issue .

    EndpointConfiguration endpoint = new EndpointConfiguration("https://textract.us-east-1.amazonaws.com", "us-east-1");
    AmazonTextract client = AmazonTextractClientBuilder.defaultClient();
Sudarshan kumar
  • 1,503
  • 4
  • 36
  • 83
0

This is happening due to version mismatch of aws sdk and textract. Keep same version, it would start working

0

I was also getting the same issue, I have degraded the version and the issue get resolved. It happens due to version mismatch.