Hi
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:
ZIP
my/code/Handler.class
lib/dependency.jar
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:
functions:hello:handler: my.code.Handler
functions:hello:handler: my.code.Handler::handleRequest
I’ve tried deployment via serverless, and via ‘cloudformation package/deploy’ all resulting in ClassNotFoundExceptions.
Any suggestion or ideas would be welcomed.
Thanks
Eugene
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