Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Error testing Resource Provider - java.lang.ClassNotFoundException: software.amazon.cloudformation.<projectName>.HandlerWrapper

Open
#238 1 comment 0 reactions 1 assignee View on GitHub

@chuchocd85 is already working on this.

Since Sep 22, 2020.

Assessment

This issue has not been assessed yet.

Description

investigating

I'm following this tutorial here [1], and creating a Resource Provider using the cfn CLI.

When I run "sam local invoke TestEntrypoint --event sam-tests/create.json" I get error below.

Invoking software.amazon.cloudformation.command.HandlerWrapper::testEntrypoint (java8)

Fetching lambci/lambda:java8 Docker container image......
Mounting /Users/shantgup/Documents/CloudFormation-Command-Project/target/aws-cloudformation-command-handler-1.0-SNAPSHOT.jar as /var/task:ro,delegated inside runtime container
START RequestId: 4d2dbf5e-b8c6-159e-9687-8b59ce7d918a Version: $LATEST
java.lang.ClassNotFoundException: software.amazon.cloudformation.command.HandlerWrapper
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	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)

Exception in thread "main" java.lang.Error: java.lang.RuntimeException: java.lang.RuntimeException: Unexpected status code from invocation/response: 299
	at lambdainternal.AWSLambda.<clinit>(AWSLambda.java:65)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:119)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unexpected status code from invocation/response: 299
	at lambdainternal.LambdaRuntime.reportDone(LambdaRuntime.java:227)
	at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:366)
	at lambdainternal.AWSLambda.<clinit>(AWSLambda.java:63)
	... 3 more
Caused by: java.lang.RuntimeException: Unexpected status code from invocation/response: 299
	at lambdainternal.LambdaRuntime.reportDone(LambdaRuntime.java:224)
	... 5 more

Now the file does not exist in my "src/main/java/software/amazon/cloudformation/<project_name>/"

But I see 3 of them in /target/classes/software/amazon/cloudformation/<project_name>. There's HandlerWrapper.class, HandlerWrapper$1.class, HandlerWrapper$2.class, HandlerWrapper$3.class.

Also, my build steps have been as follows:

1. cfn generate
2. Build project in IntelliJ Idea
3. sam local invoke TestEntrypoint --event sam-tests/create.json

Any help to troubleshoot / fix this would be greatly appreciated.

[1] - https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-walkthrough.html

Dominant language
Java
Stars
30
Forks
48
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws-cloudformation/cloudformation-cli-java-plugin

All issues in aws-cloudformation/cloudformation-cli-java-plugin

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.