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

Cannot deploy app writing in Scala

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.4.0
    • Component/s: None
    • Labels:
    • Release Notes:
      Fixed a bug that Applications written in Scala cannot be deployed
    • Rank:
      1|hzz7o7:

      Description

      When write an App in Scala like this:

      class App extends AbstractApplication {
        override def configure() {
          ...
        }
      }
      

      Deployment will fail with a transaction failure error. Digging into the log, it shows this:

      2016-02-29 10:40:10,567 - ERROR [netty-executor-8:c.c.c.i.a.d.InMemoryConfigurator@138] - null
      java.lang.InstantiationException: null
              at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[na:1.7.0_80]
              at java.lang.reflect.Constructor.newInstance(Constructor.java:526) ~[na:1.7.0_80]
              at java.lang.Class.newInstance(Class.java:383) ~[na:1.7.0_80]
              at co.cask.cdap.internal.app.deploy.InMemoryConfigurator.getSpecJson(InMemoryConfigurator.java:178) ~[classes/:na]
              at co.cask.cdap.internal.app.deploy.InMemoryConfigurator.createResponse(InMemoryConfigurator.java:158) ~[classes/:na]
              at co.cask.cdap.internal.app.deploy.InMemoryConfigurator.config(InMemoryConfigurator.java:132) ~[classes/:na]
              at co.cask.cdap.internal.app.deploy.pipeline.LocalArtifactLoaderStage.process(LocalArtifactLoaderStage.java:88) [classes/:na]
              at co.cask.cdap.internal.app.deploy.pipeline.LocalArtifactLoaderStage.process(LocalArtifactLoaderStage.java:47) [classes/:na]
              at co.cask.cdap.pipeline.AbstractStage.process(AbstractStage.java:52) [classes/:na]
              at co.cask.cdap.internal.pipeline.SynchronousPipeline.execute(SynchronousPipeline.java:56) [classes/:na]
              at co.cask.cdap.internal.app.deploy.LocalApplicationManager.deploy(LocalApplicationManager.java:117) [classes/:na]
              at co.cask.cdap.internal.app.services.ApplicationLifecycleService.deployApp(ApplicationLifecycleService.java:538) [classes/:na]
              at co.cask.cdap.internal.app.services.ApplicationLifecycleService.deployAppAndArtifact(ApplicationLifecycleService.java:293) [classes/:na]
              at co.cask.cdap.gateway.handlers.AppLifecycleHttpHandler$2.onFinish(AppLifecycleHttpHandler.java:395) [classes/:na]
              at co.cask.cdap.common.http.AbstractBodyConsumer.finished(AbstractBodyConsumer.java:65) [classes/:na]
              at co.cask.http.HttpMethodInfo.bodyConsumerFinish(HttpMethodInfo.java:149) [netty-http-0.14.0.jar:na]
              at co.cask.http.HttpMethodInfo.chunk(HttpMethodInfo.java:108) [netty-http-0.14.0.jar:na]
              at co.cask.http.HttpDispatcher.messageReceived(HttpDispatcher.java:40) [netty-http-0.14.0.jar:na]
              at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) [netty-3.6.6.Final.jar:na]
              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.6.6.Final.jar:na]
              at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) [netty-3.6.6.Final.jar:na]
              at org.jboss.netty.handler.execution.ChannelUpstreamEventRunnable.doRun(ChannelUpstreamEventRunnable.java:43) [netty-3.6.6.Final.jar:na]
              at org.jboss.netty.handler.execution.ChannelEventRunnable.run(ChannelEventRunnable.java:67) [netty-3.6.6.Final.jar:na]
              at org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor$ChildExecutor.run(OrderedMemoryAwareThreadPoolExecutor.java:314) [netty-3.6.6.Final.jar:na]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_80]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_80]
              at java.lang.Thread.run(Thread.java:745) [na:1.7.0_80]
      

      The failure is because Scala compiler will generate a parameterized type for the app if it is missing of type scala.runtime.Nothing$.

      To make thing worse, once an error like that happened, even the app is fixed by added a Config type for the app, deployment still fails, due to failure to delete the old meta data.

      Caused by: java.lang.IllegalArgumentException: Undefined schema java.lang.StackTraceElement
              at co.cask.cdap.api.data.schema.Schema.resolveSchema(Schema.java:821) ~[classes/:na]
              at co.cask.cdap.api.data.schema.Schema.resolveSchema(Schema.java:809) ~[classes/:na]
              at co.cask.cdap.api.data.schema.Schema.resolveSchema(Schema.java:797) ~[classes/:na]
              at co.cask.cdap.api.data.schema.Schema.populateRecordFields(Schema.java:772) ~[classes/:na]
              at co.cask.cdap.api.data.schema.Schema.<init>(Schema.java:394) ~[classes/:na]
              at co.cask.cdap.api.data.schema.Schema.recordOf(Schema.java:332) ~[classes/:na]
              at co.cask.cdap.internal.io.SchemaTypeAdapter.readRecord(SchemaTypeAdapter.java:218) ~[classes/:na]
              at co.cask.cdap.internal.io.SchemaTypeAdapter.read(SchemaTypeAdapter.java:109) ~[classes/:na]
              at co.cask.cdap.internal.io.SchemaTypeAdapter.read(SchemaTypeAdapter.java:62) ~[classes/:na]
              at co.cask.cdap.internal.io.SchemaTypeAdapter.read(SchemaTypeAdapter.java:48) ~[classes/:na]
              at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) ~[gson-2.2.4.jar:na]
              at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) ~[gson-2.2.4.jar:na]
              at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) ~[gson-2.2.4.jar:na]
              at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81) ~[gson-2.2.4.jar:na]
              at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60) ~[gson-2.2.4.jar:na]
              at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) ~[gson-2.2.4.jar:na]
              at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) ~[gson-2.2.4.jar:na]
              at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) ~[gson-2.2.4.jar:na]
              at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) ~[gson-2.2.4.jar:na]
              at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) ~[gson-2.2.4.jar:na]
              at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) ~[gson-2.2.4.jar:na]
              at com.google.gson.Gson.fromJson(Gson.java:803) ~[gson-2.2.4.jar:na]
              at com.google.gson.Gson.fromJson(Gson.java:768) ~[gson-2.2.4.jar:na]
              at com.google.gson.Gson.fromJson(Gson.java:717) ~[gson-2.2.4.jar:na]
              at com.google.gson.Gson.fromJson(Gson.java:689) ~[gson-2.2.4.jar:na]
              at co.cask.cdap.internal.app.runtime.artifact.ArtifactStore.deleteMeta(ArtifactStore.java:802) ~[classes/:na]
              at co.cask.cdap.internal.app.runtime.artifact.ArtifactStore.access$2900(ArtifactStore.java:141) ~[classes/:na]
              at co.cask.cdap.internal.app.runtime.artifact.ArtifactStore$14.apply(ArtifactStore.java:690) ~[classes/:na]
              at co.cask.cdap.internal.app.runtime.artifact.ArtifactStore$14.apply(ArtifactStore.java:678) ~[classes/:na]
              at co.cask.tephra.DefaultTransactionExecutor.executeOnce(DefaultTransactionExecutor.java:136) ~[tephra-core-0.6.5.jar:na]
              ... 21 common frames omitted
      

      Due to the fact that the scala.runtime.Nothing$ type contains a field of type java.lang.StacktraceElement which cannot be deserialized by GSON.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                terence Terence Yim
                Reporter:
                terence Terence Yim
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: