-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java Handler not found sam 0.3.0 #413
Comments
Appears to have the same issue with dotnetcore2.0 runtime. However, 0.3.0 is the first version of SAM that I have used, so I don't know if this is a new problem. I'm just trying to get something working. 2018-05-16 14:54:00 Decompressing C:\Users\Sean\Documents\src\AwsSamNetCore\AwsSamNetCore\bin\Release\netcoreapp2.0\publish\publish.zip Fetching lambci/lambda:dotnetcore2.0 Docker container image...... Unhandled Exception: AWSLambda.Internal.Bootstrap.LambdaValidationException: Unable to load type 'AwsSamNetCore.LambdaEntryPoint' from assembly 'AwsSamNetCore'. |
I am experiencing an identical problem. I've been running SAM 0.2.11 for about a month, installed via NPM and haven't had any issues. I just switched to SAM 0.3.0 this morning and I now have an identical issue as the OP, SAM is throwing a ClassNotFoundException for my handlers, even though I've manually verified that they exist within the zip file it claims to be opening. I will switch back to 0.2.11 for now as not being able to work locally is a bit of a blocker. |
Smells of the same issue reported here #389. There is a work around listed there, namely don't zip and just point the CodeUri to the jar. Without further investigation, I can't say if they are the same or not but worth a shot. |
Interestingly enough, after reverting back to 0.2.11 I'm having the exact same problem. I removed all of the docker instances and images and tried from scratch and I'm still getting the ClassNotFoundException for my handler. I'm a little baffled at this point. |
@jfuss I think you are correct. After pointing my template directly at the output folder instead of the zip file it started working, both with versions 0.2.11 and 0.3. |
We need integration tests with Java Lambda Function code to make sure this scenario is covered and worked. |
Same issue, when unzipping its work. when specifing jar or zip it doesnt work. |
Same issue using Java sample (commit f1c4c49, now documented in README but removed) |
Description:
Hello, since updating to version 0.3 my java lambda cannot find its handler.
Steps to reproduce the issue:
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Output of
sam --version
:Debug logs:
2018-05-14 14:28:23 Mounting CreateJob at http://127.0.0.1:3000/job [PUT]
2018-05-14 14:28:23 Mounting GetJobList at http://127.0.0.1:3000/job [GET]
2018-05-14 14:28:23 Mounting UpdateJob at http://127.0.0.1:3000/job [POST]
2018-05-14 14:28:23 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2018-05-14 14:28:23 * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
2018-05-14 14:28:30 Invoking com.mypackage.JobHandler::getList (java8)
2018-05-14 14:28:30 Found credentials in shared credentials file: ~/.aws/credentials
2018-05-14 14:28:30 Decompressing /home/alexander/projects/mypackage/target/mypackage-1.0-SNAPSHOT.jar
Fetching lambci/lambda:java8 Docker container image......
2018-05-14 14:28:33 Mounting /tmp/tmpdCCYam as /var/task:ro inside runtime container
START RequestId: 04199ee0-884e-4f31-a7b2-bc4ec7dd8c13 Version: $LATEST
java.lang.ClassNotFoundException: com.mypackage.handlers.JobHandler
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
END RequestId: 04199ee0-884e-4f31-a7b2-bc4ec7dd8c13
REPORT RequestId: 04199ee0-884e-4f31-a7b2-bc4ec7dd8c13 Duration: 3.80 ms Billed Duration: 100 ms Memory Size: 192 MB Max Memory Used: 4 MB
2018-05-14 14:28:34 Function returned an invalid response (must include one of: body, headers or statusCode in the response object). Response received:
2018-05-14 14:28:34 127.0.0.1 - - [14/May/2018 14:28:34] "GET /job HTTP/1.1" 502 -
The text was updated successfully, but these errors were encountered: