NoClassDefFoundError while running a program using AWS SDK for java

Ben Danon picture Ben Danon · Jun 13, 2012 · Viewed 10.6k times · Source

Im trying to run the DynamoDB sample that comes with the AWS SDK for java. Im doing it using eclipse, and added the aws-java-sdk-1.3.2.jar file to the build path of the project. Compilation of course goes fine, but im getting a runtime exception named NoClassDefFoundError. I know it means that the class was there at compilation but couldn't be found at runtime. I tried adding the jar file to env variables - didn't help. I also checked and there is no problem using other external jar files on other projects. Same problem on both windows and linux.

help anyone?

Thanks, ben.

Stack Trace:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at com.amazonaws.services.dynamodb.AmazonDynamoDBClient.<clinit>(AmazonDynamoDBClient.java:62)
    at AmazonDynamoDBSample.init(AmazonDynamoDBSample.java:62)
    at AmazonDynamoDBSample.main(AmazonDynamoDBSample.java:67)

Answer

Pedro Aur&#233;lio picture Pedro Aurélio · Jun 6, 2013

Inside the aws-java-sdk-1.3.2 folder you will find another folder named "third-party". All the third-party files used by Amazon SDK are inside that folder, including Apache Common Logging. You have to add the required files to your classpath along with AWS SDK jar files.