This might not be a direct serverless issue, but it is related to packaging of dependencies, along with the handler code, into a zip, which is then specified in serverless.yaml as [ package:artifact:package.zip ]
According to these instructions by AWS, they prescribe that one should put your own code at the root of the zip, and dependency jars inside a lib/ directory. Eg:
The Handler class implements
RequestHandler<Map<String, Object>, String> with a a method
public String handleRequest(Map<String, Object> event, Context context) as per Lambda Function Handler (java) :docs.aws.amazon.com /en_en/ lambda/latest/dg/java-programming-model-handler-types.html
I’ve tried both handler definitions:
I’ve tried deployment via serverless, and via ‘cloudformation package/deploy’ all resulting in ClassNotFoundExceptions.
Any suggestion or ideas would be welcomed.
PS. To try this problem from another angle, but still the same core problem: I found another project on github where this type of packaging was mentioned. I retrofitted one of their samples with maven directives and recreated the problem. If that might help to show the problem, see https://github.com/awslabs/aws-serverless-java-container/issues/133#issuecomment-400712212