[AWS SDK] java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration | Adobe Higher Education
Skip to main content
thiagos66211318
April 28, 2020
Besvarat

[AWS SDK] java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration

  • April 28, 2020
  • 3 svar
  • 19208 visningar

Hi everyone, good afternoon.

We have a custom bundle that wires up the whole AWS SDK OSGI package and export it, so the other part of application can take advantage of the AWS SDK as well. This is working properly, we have an AEM preprocessor that pushes some data to AWS CloudSearch.

 

I'm trying to take advantage of that bundle that is already installed and running on upper environments, but I'm struggling with it and it seems that AEM is not finding the correct resolution for some classes, it gives me the NoClassDefFoundError error:

 

java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration at com.amazonaws.ClientConfigurationFactory.getDefaultConfig(ClientConfigurationFactory.java:46) [com.xxx.aws.cloudsearch.xxx-cloudsearch-bundle:3.0.1] at com.amazonaws.ClientConfigurationFactory.getConfig(ClientConfigurationFactory.java:36) [com.xxx.aws.cloudsearch.xxx-cloudsearch-bundle:3.0.1] at com.amazonaws.services.cloudfront.AmazonCloudFrontClient.<init>(AmazonCloudFrontClient.java:140) [com.xxx.aws.cloudsearch.xxx-cloudsearch-bundle:3.0.1]

 

 

My pom.xml looks like this:

 

I took a look at http://localhost:4502/system/console/bundles and it seems that my dependency is properly resolved as we can see below:

 

This is the custom bundle (xxx.xxx.xxx.cloudsearch-bundle) and how it exports the amazon dependencies:

 

 

EDIT 1:

I've double checked and that class is being resolved by AEM:

Anyone has an idea?

Thank you.

Regards.

 

Det här ämnet har stängts för svar.
Bästa svar av joerghoh

This exception "

java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration

does not necessarily mean that the problem is the class com.amazonaws.ClientConfiguration itself, but that it happened within the constructor of that class. Can you show us the complete exception? 

3 svar

VeenaVikraman
Community Advisor
Community Advisor
April 29, 2020

@thiagos66211318  I am not able to correctly identify the issue. But are you sure the import for ClientConfiguration is resolved properly ? 

thiagos66211318
April 29, 2020
Hi @veenavikraman I'ved added a screenshot of the package dependency and we can see that "ClientConfiguration" is found by AEM.
joerghoh
Adobe Employee
Adobe Employee
April 30, 2020

This exception "

java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration

does not necessarily mean that the problem is the class com.amazonaws.ClientConfiguration itself, but that it happened within the constructor of that class. Can you show us the complete exception?