Hi to all, my name is Phaedra, i'm working in a company in Italy specialized in 
data management for public/private libraries.
We are evaluating Avro for our rpc needs, for now Avro mapping seems to be 
really better than thrift or protobuf one.

BUT, I'm stuck while compiling an avdl file to avcr file and then compiling to 
beans.

IDL file example:

@namespace("avro.bean")
protocol MyProtocol {

  record MyBean {
    union { null, string } cd;
    union { null, string } ds;
  }

  MyBean getMyBean(array<string> array);
}

Morph in to this:

{
  "protocol" : "MyProtocol",
  "namespace" : "avro.bean",
  "types" : [ {
    "type" : "record",
    "name" : "MyBean",
    "fields" : [ {
      "name" : "cd",
      "type" : [ "null", "string" ]
    }, {
      "name" : "ds",
      "type" : [ "null", "string" ]
    } ]
  } ],
  "messages" : {
    "getMyBean" : {
      "request" : [ {
        "name" : "array",
        "type" : {
          "type" : "array",
          "items" : "string"
        }
      } ],
      "response" : "MyBean"
    }
  }
}

For now, it's going all as expected.
BUT when I'm going to compile the schema:

Input files to compile:
  avro\idl.avpr

Exception in thread "main" org.apache.avro.SchemaParseException: No type: 
{"protocol":"MyProtocol","namespace":"avro.bea
n","types":[{"type":"record","name":"MyBean","fields":[{"name":"cd","type":["null","string"]},{"name":"ds","type":["null
","string"]}]}],"messages":{"getMyBean":{"request":[{"name":"array","type":{"type":"array","items":"string"}}],"response
":"MyBean"}}}
        at org.apache.avro.Schema.getRequiredText(Schema.java:1221)
        at org.apache.avro.Schema.parse(Schema.java:1082)
        at org.apache.avro.Schema$Parser.parse(Schema.java:953)
        at org.apache.avro.Schema$Parser.parse(Schema.java:922)
        at 
org.apache.avro.tool.SpecificCompilerTool.run(SpecificCompilerTool.java:73)
        at org.apache.avro.tool.Main.run(Main.java:84)
        at org.apache.avro.tool.Main.main(Main.java:73)

Argh, no way to understand what's happening in the compiling process.

Can someone help me out this one???

Thanks, Phaedra.

Reply via email to