AWS Java SDK Error - Java Callout

I am receiving the following error in Java Callout deployed in APIGEE. If I test it locally, it works. 

 

Java Version - OpenJDK 11

 

eported error entities.ConfigurationFailed: "Configuration failure: Caused by: java.lang.NoClassDefFoundError: software/amazon/awssdk/auth/credentials/AwsCredentials\n\tat java.base/java.lang.Class.forName0(Native Method)\n\tat java.base/java.lang.Class.forName(Class.java:398)\n\tat com.apigee.steps.javacallout.JavaCalloutStepDefinition$CallOutWrapper.initialize(JavaCalloutStepDefinition.java:93)\n\tat

 

Depdendecies Used:

<dependency>
<groupId>com.apigee.edge</groupId>
<artifactId>message-flow</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.apigee.edge</groupId>
<artifactId>expressions</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sqs</artifactId>
<version>2.25.3</version>
 
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>auth</artifactId>
<version>2.25.3</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.12.674</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.16</version>
</dependency>
 
Can someone assist on this.
3 4 160
4 REPLIES 4

A. It seems like you haven't bundled the required JAR into the proxy. With java.lang.NoClassDefFoundError, Apigee is telling you that it cannot find a class. you need to package the JAR that contains the callout class, plus all its dependencies, into the proxy bundle in order to allow Apigee to instantiate the callout class. If you build some custom code that relies on the AWS SDK, then you must package your JAR, plus at least the AWS SDK JAR, into the proxy bundle.

B. I think once you resolve the class-not-found problems, you will run into permissions or size problems. See here and here. so I think you might want to reconsider building a Java callout that depends on the AWS SDK JAR.

Thanks Dino, I tried with the signature method from https://github.com/DinoChiesa/Apigee-Java-AWSV4-Signature

I did raise an issue in the repo, on generating the AWS v4 signature, that is being generated but on sending message to SQS, I was receiving 403. Can you have a look at the issue raised in PR and let me help with it. 

@dchiesa1 any updates on the issue  raised in github repo. I am kind of stuck here. 

I replied on the github repo, but the short answer is: this is something you need to investigate. I see no evidence that there's a problem in the callout.