AWS Lambda NoClassDefFoundError
Use the maven-shade plugin so that the JAR contains the dependencies in an uber-jar.
So, add this to your pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Source: http://docs.aws.amazon.com/lambda/latest/dg/java-create-jar-pkg-maven-no-ide.html
Potentially you may have this issue https://github.com/aws/aws-lambda-java-libs/issues/2 which requires a downgrade to aws-lambda-java-events-1.0.0.jar
=== If this issue exists even after including shaded jar ===
If you have this issue even after having shaded jar then the issue should be related to aws-lambda-java-events package version (should be some incompatibility between AWS lamda version and newer aws-lambda-java-events version) . i.e. I had this issue with latest version (2.0.2) of aws-lambda-java-events package and I have to downgrade the version to 1.3.0.
Seems like newer aws-lambda-java-events version doesn't have many dependencies.
Sometimes you have to upload your lambda again. Also I got the same issue I fixed with this pom.xml:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>1.11.83</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>