Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> Re: Hi to all, little problem when compiling avcr


Copy link to this message
-
Re: Hi to all, little problem when compiling avcr
Hi,

It looks like you are invoking the Avro compiler for a schema instead of
for a protocol.
If you are running a command like this one:
    $ java -jar path/to/avro-tools.jar compile schema path/to/idl.avpr
path/to/generated

Then you should try:
    $ java -jar path/to/avro-tools.jar compile protocol path/to/idl.avpr
path/to/generated

C.
On Thu, Feb 6, 2014 at 1:14 AM, Casadio Phaedra <
[EMAIL PROTECTED]> wrote:

> 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.
>
>
>

 
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB