You're calling GoraCompiler#main, which inherits
SpecificCompiler#main, which unconditionally calls compileSchema.

You could wrap your record schema in {"protocol":"X", ..., "types": [
<schema> ] } so this works.

Or you might use SpecificCompilerTool, which supports compiling both
schemas and protocols from the command line.  This is in the
avro-tools jar with dependencies included or in avro-tools-nodeps
without.

Doug



On Wed, Jan 7, 2015 at 10:49 AM, Lewis John Mcgibbney
<lewis.mcgibb...@gmail.com> wrote:
> Hey Joey or anyone else.
> Any ideas what is up here? I read through the Avro spec to see if I was
> missing something (which I most likely am) but couldn't find a sausage.
> Thanks again in advance for any help.
> The schema is valid JSON, the stack trace is looking for a Protocol when it
> is clearly marked as a Record.
>
> On Tue, Jan 6, 2015 at 2:42 PM, Joey Echeverria <j...@cloudera.com> wrote:
>>
>> Can you send the definition of the ant task that you're using to parse it?
>>
>> -Joey
>>
>> On Tue, Jan 6, 2015 at 1:50 PM, Lewis John Mcgibbney
>> <lewis.mcgibb...@gmail.com> wrote:
>> > Hi Folks,
>> > I have the following small schema
>> >
>> > {
>> >   "name": "Host",
>> >   "type": "record",
>> >   "namespace": "org.apache.nutch.storage",
>> >   "doc": "Host represents a store of webpages or other data which
>> > resides on
>> > a server or other computer so that it can be accessed over the
>> > Internet",
>> >   "fields": [
>> >     {
>> >       "name": "metadata",
>> >       "type": {
>> >         "type": "map",
>> >         "values": ["null","bytes"]
>> >       },
>> >       "doc": "A multivalued metadata container used for storing a wide
>> > variety of host metadata such as structured web server characterists
>> > etc",
>> >       "default": {
>> >
>> >       }
>> >     },
>> >     {
>> >       "name": "outlinks",
>> >       "type": {
>> >         "type": "map",
>> >         "values": ["null","string"]
>> >       },
>> >       "doc": "Hyperlinks which direct outside of the current host domain
>> > these can used in a histogram style manner to generate host statistics",
>> >       "default": {
>> >
>> >       }
>> >     },
>> >     {
>> >       "name": "inlinks",
>> >       "type": {
>> >         "type": "map",
>> >         "values": ["null","string"]
>> >       },
>> >       "doc": "Hyperlinks which link to pages within the current host
>> > domain
>> > these can used in a histogram style manner to generate host statistics",
>> >       "default": {
>> >
>> >       }
>> >     }
>> >   ]
>> > }
>> >
>> >
>> > When I use Avro 1.7.6 to parse it via an Ant task, I am getting the
>> > following parse exception
>> >
>> >      [java] Caused by: org.apache.avro.SchemaParseException: No protocol
>> > name specified:
>> >
>> > {"name":"Host","type":"record","namespace":"org.apache.nutch.storage","doc":"Host
>> > represents a store of webpages or other data which resides on a server
>> > or
>> > other computer so that it can be accessed over the
>> >
>> > Internet","fields":[{"name":"metadata","type":{"type":"map","values":["null","bytes"]},"doc":"A
>> > multivalued metadata container used for storing a wide variety of host
>> > metadata such as structured web server characterists
>> >
>> > etc","default":{}},{"name":"outlinks","type":{"type":"map","values":["null","string"]},"doc":"Hyperlinks
>> > which direct outside of the current host domain these can used in a
>> > histogram style manner to generate host
>> >
>> > statistics","default":{}},{"name":"inlinks","type":{"type":"map","values":["null","string"]},"doc":"Hyperlinks
>> > which link to pages within the current host domain these can used in a
>> > histogram style manner to generate host statistics","default":{}}]}
>> >      [java]     at org.apache.avro.Protocol.parseName(Protocol.java:426)
>> >      [java]     at org.apache.avro.Protocol.parse(Protocol.java:399)
>> >      [java]     at org.apache.avro.Protocol.parse(Protocol.java:390)
>> >      [java]     at org.apache.avro.Protocol.parse(Protocol.java:361)
>> >      [java]     at
>> >
>> > org.apache.avro.compiler.specific.SpecificCompiler.compileProtocol(SpecificCompiler.java:248)
>> >      [java]     at
>> >
>> > org.apache.avro.compiler.specific.SpecificCompiler.compileProtocol(SpecificCompiler.java:238)
>> >      [java]     at
>> >
>> > org.apache.avro.compiler.specific.SpecificCompiler.main(SpecificCompiler.java:719)
>> >      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> > Method)
>> >      [java]     at
>> >
>> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> >      [java]     at
>> >
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> >      [java]     at java.lang.reflect.Method.invoke(Method.java:606)
>> >      [java]     at
>> > org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
>> >      [java]     at
>> > org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
>> >      [java]     ... 20 more
>> >      [java] Java Result: -1
>> >
>> > The thing is that I do not wish this to be a Protocol as such, it is
>> > merely
>> > a simple Schema. Can anyone help me out to debug this?
>> > Thank you
>> > Lewis
>> >
>> > --
>> > Lewis
>>
>>
>>
>> --
>> Joey Echeverria
>
>
>
>
> --
> Lewis

Reply via email to