cloudformation-cli
cloudformation-cli copied to clipboard
PLUGIN_REGISTRY[language]()() KeyError: 'java'
➜ aws-ec2-networkinsightspath git:(mainline) cfn test --endpoint https://ec2.us-east-1.amazon.com
=== Unhandled exception ===
Please report this issue to the team.
Issue tracker: github.com/aws-cloudformation/cloudformation-cli/issues
Please include the log file 'rpdk.log'
➜ aws-ec2-networkinsightspath git:(mainline) ls
README.md build.gradle inputs pom.xml rpdk.log src
aws-ec2-networkinsightspath.json canary-bundle lombok.config resource-role.yaml settings.internal.json template.yml
➜ aws-ec2-networkinsightspath git:(mainline) cat rpdk.log
[2021-06-03T17:47:39Z] DEBUG - Logging set up successfully
[2021-06-03T17:47:39Z] DEBUG - Running test: Namespace(version=False, subparser_name='test', command=<function test at 0x11f475a60>, verbose=0, endpoint='http://127.0.0.1:3001', function_name='TypeFunction', region='us-east-1', role_arn=None, cloudformation_endpoint_url=None, enforce_timeout='30', log_group_name=None, log_role_arn=None, passed_to_pytest=[], docker_image=None)
[2021-06-03T17:47:39Z] DEBUG - Root directory: /Volumes/workspace/AWSCloudFormationResourceProvidersEC2NI/src/AWSCloudFormationResourceProvidersNetworkInsights/aws-ec2-networkinsightspath
[2021-06-03T17:47:39Z] DEBUG - Loading project file '/Volumes/workspace/AWSCloudFormationResourceProvidersEC2NI/src/AWSCloudFormationResourceProvidersNetworkInsights/aws-ec2-networkinsightspath/.rpdk-config'
[2021-06-03T17:47:39Z] DEBUG - Unhandled exception
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/rpdk/core/cli.py", line 100, in main
args.command(args)
File "/usr/local/lib/python3.9/site-packages/rpdk/core/test.py", line 181, in test
project.load()
File "/usr/local/lib/python3.9/site-packages/rpdk/core/project.py", line 413, in load
self.load_settings()
File "/usr/local/lib/python3.9/site-packages/rpdk/core/project.py", line 202, in load_settings
self.validate_and_load_resource_settings(raw_settings)
File "/usr/local/lib/python3.9/site-packages/rpdk/core/project.py", line 231, in validate_and_load_resource_settings
self._plugin = load_plugin(raw_settings["language"])
File "/usr/local/lib/python3.9/site-packages/rpdk/core/plugin_registry.py", line 27, in load_plugin
return PLUGIN_REGISTRY[language]()()
KeyError: 'java'
[2021-06-03T17:48:07Z] DEBUG - Logging set up successfully
[2021-06-03T17:48:07Z] DEBUG - Running test: Namespace(version=False, subparser_name='test', command=<function test at 0x11b105af0>, verbose=0, endpoint='http://127.0.0.1:3001', function_name='TypeFunction', region='us-east-1', role_arn=None, cloudformation_endpoint_url=None, enforce_timeout='30', log_group_name=None, log_role_arn=None, passed_to_pytest=[], docker_image=None)
[2021-06-03T17:48:07Z] DEBUG - Root directory: /Volumes/workspace/AWSCloudFormationResourceProvidersEC2NI/src/AWSCloudFormationResourceProvidersNetworkInsights/aws-ec2-networkinsightspath
[2021-06-03T17:48:07Z] DEBUG - Loading project file '/Volumes/workspace/AWSCloudFormationResourceProvidersEC2NI/src/AWSCloudFormationResourceProvidersNetworkInsights/aws-ec2-networkinsightspath/.rpdk-config'
[2021-06-03T17:48:07Z] DEBUG - Unhandled exception
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/rpdk/core/cli.py", line 100, in main
args.command(args)
File "/usr/local/lib/python3.9/site-packages/rpdk/core/test.py", line 181, in test
project.load()
File "/usr/local/lib/python3.9/site-packages/rpdk/core/project.py", line 413, in load
self.load_settings()
File "/usr/local/lib/python3.9/site-packages/rpdk/core/project.py", line 202, in load_settings
self.validate_and_load_resource_settings(raw_settings)
File "/usr/local/lib/python3.9/site-packages/rpdk/core/project.py", line 231, in validate_and_load_resource_settings
self._plugin = load_plugin(raw_settings["language"])
File "/usr/local/lib/python3.9/site-packages/rpdk/core/plugin_registry.py", line 27, in load_plugin
return PLUGIN_REGISTRY[language]()()
KeyError: 'java'
[2021-06-03T17:48:14Z] DEBUG - Logging set up successfully
[2021-06-03T17:48:14Z] DEBUG - Running test: Namespace(version=False, subparser_name='test', command=<function test at 0x1171baaf0>, verbose=0, endpoint='https://ec2.us-east-1.amazon.com', function_name='TypeFunction', region='us-east-1', role_arn=None, cloudformation_endpoint_url=None, enforce_timeout='30', log_group_name=None, log_role_arn=None, passed_to_pytest=[], docker_image=None)
[2021-06-03T17:48:14Z] DEBUG - Root directory: /Volumes/workspace/AWSCloudFormationResourceProvidersEC2NI/src/AWSCloudFormationResourceProvidersNetworkInsights/aws-ec2-networkinsightspath
[2021-06-03T17:48:14Z] DEBUG - Loading project file '/Volumes/workspace/AWSCloudFormationResourceProvidersEC2NI/src/AWSCloudFormationResourceProvidersNetworkInsights/aws-ec2-networkinsightspath/.rpdk-config'
[2021-06-03T17:48:14Z] DEBUG - Unhandled exception
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/rpdk/core/cli.py", line 100, in main
args.command(args)
File "/usr/local/lib/python3.9/site-packages/rpdk/core/test.py", line 181, in test
project.load()
File "/usr/local/lib/python3.9/site-packages/rpdk/core/project.py", line 413, in load
self.load_settings()
File "/usr/local/lib/python3.9/site-packages/rpdk/core/project.py", line 202, in load_settings
self.validate_and_load_resource_settings(raw_settings)
File "/usr/local/lib/python3.9/site-packages/rpdk/core/project.py", line 231, in validate_and_load_resource_settings
self._plugin = load_plugin(raw_settings["language"])
File "/usr/local/lib/python3.9/site-packages/rpdk/core/plugin_registry.py", line 27, in load_plugin
return PLUGIN_REGISTRY[language]()()
KeyError: 'java'
Try installing the language plugin as well:
pip3 install cloudformation-cli-java-plugin --upgrade
That worked, thanks! Now the tests start running but are still failing. What endpoint should I be using if I want to test our contracts in prod?
I tried just using our prod service endpoint cfn test --endpoint https://ec2.us-east-1.amazon.com
but got this error
E botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://ec2.us-east-1.amazon.com/2015-03-31/functions/TypeFunction/invocations"
shouldn't have to specify endpoint for cfn test
should just spin up SAM locally in your resource provider directory first:
sam local start-lambda &
I was trying to avoid that due to all the extra setup & issues it involves. Is there a way to just run it against the prod service? Sounds like not?
So for using SAM locally, I ran into
Invoking software.amazon.ec2.networkinsightspath.HandlerWrapper::handleRequest (java8)
Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-java8:rapid-1.24.0.
Mounting /Volumes/workspace/AWSCloudFormationResourceProvidersEC2NI/src/AWSCloudFormationResourceProvidersNetworkInsights/aws-ec2-networkinsightspath/target/aws-ec2-networkinsightspath-1.0.jar as /var/task:ro,delegated inside runtime container
START RequestId: 559eda7d-fb44-4785-86da-419fcefd9ace Version: $LATEST
Class not found: software.amazon.ec2.networkinsightspath.HandlerWrapper: java.lang.ClassNotFoundException
java.lang.ClassNotFoundException: software.amazon.ec2.networkinsightspath.HandlerWrapper
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
and was told I need to first run
mvn package
which then failed with
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to /Volumes/workspace/AWSCloudFormationResourceProvidersEC2NI/src/AWSCloudFormationResourceProvidersNetworkInsights/aws-ec2-networkinsightspath/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:43 min
[INFO] Finished at: 2021-06-03T13:30:54-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project aws-ec2-networkinsightspath-handler: Fatal error compiling: java.lang.ExceptionInInitializerError: Unable to make field private com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors com.sun.tools.javac.processing.JavacProcessingEnvironment.discoveredProcs accessible: module jdk.compiler does not "opens com.sun.tools.javac.processing" to unnamed module @3f3a6091 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Am I missing something to make the mvn package
command work?
@kmjewell , I was able to reproduce following the tutorial here. I was able to fix the error by updating the Lombok version as suggested here.
Now I run into an error about an ambiguous method call injectCredentialsAndInvoke. After digging in, it looks like this this commit may have introduced the ambiguity: https://github.com/aws-cloudformation/cloudformation-cli-java-plugin/pull/338.