Running SAM Local with Java on Windows
See original GitHub issueI am trying to run the Java sample project on sam local under Windows. I have added CodeUri property to the template YAML to make the JAR file visible for SAM.
CodeUri: target/HelloWorld-1.0.jar
Docker Toolbox is installed and invoking a particular function fetches lambda docker image.
2017/10/27 08:42:08 Successfully parsed template.yml ←[34mINFO←[0m[0000] Unable to use system certificate pool: crypto/x509: system root pool is not available on Windows 2017/10/27 08:42:08 Connected to Docker 1.33 ←[34mINFO←[0m[0000] Unable to use system certificate pool: crypto/x509: system root pool is not available on Windows 2017/10/27 08:42:08 Fetching lambci/lambda:java8 image for java8 runtime… java8: Pulling from lambci/lambda Digest: sha256:5e1f24ebf98bf010e94e8eb7d3eeec3d24d2a7d97a458756dda27134de526aa2 Status: Image is up to date for lambci/lambda:java8
However invoking the function itself causes error:
2017/10/27 08:39:18 Reading invoke payload from stdin (you can also pass it from file with --event) 2017/10/27 08:39:18 Invoking com.aws.codestar.projecttemplates.handler.HelloWorldHandler (java8) 2017/10/27 08:39:18 Decompressing C:\Users\dzielins\git\P18-Bool\target\HelloWorld-1.0.jar 2017/10/27 08:39:18 Could not invoke function: Error response from daemon: invalid volume specification: ‘C:\Users\dzielins\AppData\Local\Temp\aws-sam-local-1509086358382936700:/var/task:ro’
As I have read in some other posts and README file, this might be caused by incorrect setting of Docker volume basedir. So I tried using both --docker-volume-basedir
switch and environment variable SAM_DOCKER_VOLUME_BASEDIR
by setting them to /c/Users/dzielins/git/P18-Bool
as advised. This did not help in any way, as now the error that occurs is:
2017/10/27 08:41:01 Reading invoke payload from stdin (you can also pass it from file with --event) 2017/10/27 08:41:01 Invoking com.aws.codestar.projecttemplates.handler.HelloWorldHandler (java8) ←[32mSTART RequestId: 1d73caa9-7554-485d-8eaf-81de3a712d3a Version: $LATEST←[0m ←[31mjava.lang.ClassNotFoundException: com.aws.codestar.projecttemplates.handler.HelloWorldHandler 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)
What should be done in order to make SAM Local and Docker instance see and invoke the built JAR file in correct way?
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (2 by maintainers)
Fix incoming soon!
+1