Unable to load Recipe: java.lang.IllegalArgumentException: Cannot construct instance

101 Views Asked by At

I am trying to create own OpenRewrite recipes by follow up recipe-development-environment instruction but getting below error while running my recipe:-

[ERROR] Recipe validation error in com.sk.app.MyMergeYaml: Unable to load Recipe: java.lang.IllegalArgumentException: Cannot construct instance of `com.sk.app.MyMergeYaml` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
     at [Source: UNKNOWN; byte offset: #UNKNOWN]
    [ERROR] Recipe validation error in com.sk.app.MyMergeYaml: Unable to load Recipe: java.lang.IllegalArgumentException: Cannot construct instance of `com.sk.app.MyMergeYaml` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
     at [Source: UNKNOWN; byte offset: #UNKNOWN]
    [ERROR] Recipe validation error in com.sk.app.MyMergeYaml: Unable to load Recipe: java.lang.IllegalArgumentException: Cannot construct instance of `com.sk.app.MyMergeYaml` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
     at [Source: UNKNOWN; byte offset: #UNKNOWN]
    [ERROR] Recipe validation errors detected as part of one or more activeRecipe(s). Execution will continue regardless.

I am able to run given sample SayHelloRecipe but in similar way I can not run my custom MyMergeYaml recipe. I have not customized anything in MergeYaml recipe yet except class name, first just willing to run same recipe with my custom project to test the structure.

Trying through my maven command:

mvn -U org.openrewrite.maven:rewrite-maven-plugin:dryRun -Drewrite.recipeArtifactCoordinates=com.sk.app:my-app:1.0-SNAPSHOT -Drewrite.activeRecipes=com.yourorg.sayHelloToFooBar

Below is my defined Yaml:-

type: specs.openrewrite.org/v1beta/recipe
name: com.yourorg.sayHelloToFooBar
recipeList:
  - com.sk.app.SayHelloRecipe:  #working
      fullyQualifiedClassName: com.manish.mywebclientrest.myRestApplication
      
  - com.sk.app.MyMergeYaml:  #Not working
      key: $.stages.parameters
      yaml: |-
        openJdkVersion: 17
0

There are 0 best solutions below