question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.ClassNotFoundException: com.example.StreamLambdaHandler

See original GitHub issue

Description:

When executing the spring-boot example:

mvn archetype:generate -DgroupId=my.service -DartifactId=my-service -Dversion=1.0-SNAPSHOT \
       -DarchetypeGroupId=com.amazonaws.serverless.archetypes \
       -DarchetypeArtifactId=aws-serverless-springboot-archetype \
       -DarchetypeVersion=1.1 

And running the project (via. sam local start-api --template sam.yaml --debug) results in the following error:

START RequestId: 9e5a7678-5dda-49a2-b244-1337d775ffa2 Version: $LATEST
java.lang.ClassNotFoundException: com.example.StreamLambdaHandler
	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)

This seems to be an issue specifically with Ubuntu sam/docker (Possibly also with ubuntu version 18.04 specifically). Running the same sam-cli 0.3.0 and docker 18.03.1-ce on OSX works correctly and a response is returned as expected.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
BoundInfinitycommented, Jun 13, 2018

+1 setup:

Ubuntu: 16.0.4 Docker: 18.03.1-ce Sam: 0.3.0

It works for JS and fails for Java. Rolling back onto Sam 0.2.11 works for Java.

1reaction
mhballcommented, Jun 13, 2018

+1 here too on:

Linux Mint 18.1 Cinnamon 64-bit Sam 0.3.0 Docker 18.03.1-ce

This is really slowing down our Java development!

Seems to work okay for JavaScript though

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class not found: com.madman.lambda ... - GitHub
Class not found: com.madman.lambda.StreamLambdaHandler: java.lang.ClassNotFoundException #354. Open. anudina opened this issue on Jun 10, ...
Read more >
AWS Lambda: class java.lang.ClassNotFoundException
Hello::handleRequest with full class path of your stream handler. For example com.abc.company.app.StreamLambdaHandler::handleRequest; Save ...
Read more >
Resolve "ClassNotFoundExeption" errors from Java Lambda ...
The ClassNotFoundException error occurs when a Java runtime loads a class by its fully qualified name, but doesn't locate the class.
Read more >
awslabs/aws-serverless-java-container - Gitter
ClassNotFoundException : com.project.customer.StreamLambdaHandler ... Try to use the same unit testing method from the samples to test the invoke in local.
Read more >
How to resolve java.lang.ClassNotFoundException in Java ...
In this java tutorial, we will see what is ClassNotFoundException in java, what is real cause of it, and how to fix it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found