Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-3442

Creating an application with config using an Application<Config> class fails

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.2.0
    • Fix Version/s: 3.2.0
    • Component/s: None
    • Labels:
      None
    • Release Notes:
      Fixed a bug that caused application creation to fail if config setting are given to an application that does not use config.
    • Rank:
      1|hzyyd3:

      Description

      If there is an application that doesn't specify a Config type and you pass in a config when creating the app, deployment fails.

      To reproduce:

      1. add HelloWorld artifact:

      $curl localhost:10000/v3/namespaces/default/artifacts/helloworld --data-binary @cdap-examples/HelloWorld/target/HelloWorld-3.2.0-SNAPSHOT.jar
      

      2. create an app with the artifact and give it a config

      $curl -v localhost:10000/v3/namespaces/default/apps/hw -X PUT -H 'Content-Type: application/json' -d '{ "config":{ "a": "b"}, "artifact": { "name":"helloworld", "version":"3.2.0.SNAPSHOT" } }'
      java.util.concurrent.ExecutionException: java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to co.cask.cdap.api.Config
      

      This is because InMemoryConfigurator tries to deserialize the config field into a Config object which cannot be done without a custom deserializer since Config contains the PluginProperties field.

        Attachments

          Activity

            People

            • Assignee:
              ashau Albert Shau
              Reporter:
              ashau Albert Shau
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: