You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by AnilKumar B <ak...@gmail.com> on 2014/02/05 17:39:38 UTC

Facing issue while using avro-maven-plugin

Hi,

I have created below .avsc schema file and I tried creating corresponding
classes by using avro tool and with plugin, but there are few errors on
generated java code. What could be the issue?


{"namespace": "test.avro",
 "type": "record",
 "name": "Session",
 "fields": [
   {"name":"VisitCommon", "type": {
           "type": "map", "values":"string"}},
   {"name":"events",
    "type": {
        "type": "array",
    "items":{
    "name":"Event",
    "type":"map",
    "values":"string"}
    }
    }
 ]
}


1) Error: The method deepCopy(Schema, List<Map<CharSequence,CharSequence>>)
is undefined for the type GenericData
2) And also observed there is some deprecated code.
 @Deprecated public
java.util.Map<java.lang.CharSequence,java.lang.CharSequence> VisitCommon;

I used eclipse plugin as mentioned below.
http://avro.apache.org/docs/1.7.6/mr.html


I tried with different versions of avro-maven-plugin, with 1.7.5, 1.7.6 and
with jdk1.7.0_45 version.

I am unable to resolve it.

Error message is as below:
[ERROR] symbol:   method
deepCopy(org.apache.avro.Schema,java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)
[ERROR] location: class org.apache.avro.generic.GenericData

Thanks & Regards,
B Anil Kumar.

Re: Facing issue while using avro-maven-plugin

Posted by AnilKumar B <ak...@gmail.com>.
Thanks Taton & Doug.

Just now, It got resolved. When I remove pig dependency from my pom, it's
stopped giving below exception.
Error: The method deepCopy(Schema, List<Map<CharSequence,CharSequence>>) is
undefined for the type GenericData

Thanks & Regards,
B Anil Kumar.


On Wed, Feb 5, 2014 at 11:48 PM, Doug Cutting <cu...@apache.org> wrote:

> The problem with deepCopy may be a mismatch between the version of
> Avro you're using at compile time and the version you're using at
> runtime.  When exactly are you getting this error?
>
> Doug
>
> On Wed, Feb 5, 2014 at 9:32 AM, Christophe Taton
> <ch...@gmail.com> wrote:
> > Hi,
> >
> > I do not know about 1), but 2) is currently expected : record fields are
> > public by default but tagged as deprecated - you can solve this by
> > explicitly asking for private fields in the Maven plugin configuration:
> >       <plugin>
> >         <groupId>org.apache.avro</groupId>
> >         <artifactId>avro-maven-plugin</artifactId>
> >         <configuration>
> >           <fieldVisibility>private</fieldVisibility>
> >         </configuration>
> >       </plugin>
> >
> > C.
> >
> >
> > On Wed, Feb 5, 2014 at 8:39 AM, AnilKumar B <ak...@gmail.com>
> wrote:
> >>
> >> Hi,
> >>
> >> I have created below .avsc schema file and I tried creating
> corresponding
> >> classes by using avro tool and with plugin, but there are few errors on
> >> generated java code. What could be the issue?
> >>
> >>
> >> {"namespace": "test.avro",
> >>  "type": "record",
> >>  "name": "Session",
> >>  "fields": [
> >>    {"name":"VisitCommon", "type": {
> >>            "type": "map", "values":"string"}},
> >>    {"name":"events",
> >>     "type": {
> >>         "type": "array",
> >>     "items":{
> >>     "name":"Event",
> >>     "type":"map",
> >>     "values":"string"}
> >>     }
> >>     }
> >>  ]
> >> }
> >>
> >>
> >> 1) Error: The method deepCopy(Schema,
> >> List<Map<CharSequence,CharSequence>>) is undefined for the type
> GenericData
> >> 2) And also observed there is some deprecated code.
> >>  @Deprecated public
> >> java.util.Map<java.lang.CharSequence,java.lang.CharSequence>
> VisitCommon;
> >>
> >> I used eclipse plugin as mentioned below.
> >> http://avro.apache.org/docs/1.7.6/mr.html
> >>
> >>
> >> I tried with different versions of avro-maven-plugin, with 1.7.5, 1.7.6
> >> and with jdk1.7.0_45 version.
> >>
> >> I am unable to resolve it.
> >>
> >> Error message is as below:
> >> [ERROR] symbol:   method
> >>
> deepCopy(org.apache.avro.Schema,java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)
> >> [ERROR] location: class org.apache.avro.generic.GenericData
> >>
> >> Thanks & Regards,
> >> B Anil Kumar.
> >
> >
>

Re: Facing issue while using avro-maven-plugin

Posted by Doug Cutting <cu...@apache.org>.
The problem with deepCopy may be a mismatch between the version of
Avro you're using at compile time and the version you're using at
runtime.  When exactly are you getting this error?

Doug

On Wed, Feb 5, 2014 at 9:32 AM, Christophe Taton
<ch...@gmail.com> wrote:
> Hi,
>
> I do not know about 1), but 2) is currently expected : record fields are
> public by default but tagged as deprecated - you can solve this by
> explicitly asking for private fields in the Maven plugin configuration:
>       <plugin>
>         <groupId>org.apache.avro</groupId>
>         <artifactId>avro-maven-plugin</artifactId>
>         <configuration>
>           <fieldVisibility>private</fieldVisibility>
>         </configuration>
>       </plugin>
>
> C.
>
>
> On Wed, Feb 5, 2014 at 8:39 AM, AnilKumar B <ak...@gmail.com> wrote:
>>
>> Hi,
>>
>> I have created below .avsc schema file and I tried creating corresponding
>> classes by using avro tool and with plugin, but there are few errors on
>> generated java code. What could be the issue?
>>
>>
>> {"namespace": "test.avro",
>>  "type": "record",
>>  "name": "Session",
>>  "fields": [
>>    {"name":"VisitCommon", "type": {
>>            "type": "map", "values":"string"}},
>>    {"name":"events",
>>     "type": {
>>         "type": "array",
>>     "items":{
>>     "name":"Event",
>>     "type":"map",
>>     "values":"string"}
>>     }
>>     }
>>  ]
>> }
>>
>>
>> 1) Error: The method deepCopy(Schema,
>> List<Map<CharSequence,CharSequence>>) is undefined for the type GenericData
>> 2) And also observed there is some deprecated code.
>>  @Deprecated public
>> java.util.Map<java.lang.CharSequence,java.lang.CharSequence> VisitCommon;
>>
>> I used eclipse plugin as mentioned below.
>> http://avro.apache.org/docs/1.7.6/mr.html
>>
>>
>> I tried with different versions of avro-maven-plugin, with 1.7.5, 1.7.6
>> and with jdk1.7.0_45 version.
>>
>> I am unable to resolve it.
>>
>> Error message is as below:
>> [ERROR] symbol:   method
>> deepCopy(org.apache.avro.Schema,java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)
>> [ERROR] location: class org.apache.avro.generic.GenericData
>>
>> Thanks & Regards,
>> B Anil Kumar.
>
>

Re: Facing issue while using avro-maven-plugin

Posted by Christophe Taton <ch...@gmail.com>.
Hi,

I do not know about 1), but 2) is currently expected : record fields are
public by default but tagged as deprecated - you can solve this by
explicitly asking for private fields in the Maven plugin configuration:
      <plugin>
        <groupId>org.apache.avro</groupId>
        <artifactId>avro-maven-plugin</artifactId>
        <configuration>
          <fieldVisibility>private</fieldVisibility>
        </configuration>
      </plugin>

C.


On Wed, Feb 5, 2014 at 8:39 AM, AnilKumar B <ak...@gmail.com> wrote:

> Hi,
>
> I have created below .avsc schema file and I tried creating corresponding
> classes by using avro tool and with plugin, but there are few errors on
> generated java code. What could be the issue?
>
>
> {"namespace": "test.avro",
>  "type": "record",
>  "name": "Session",
>  "fields": [
>    {"name":"VisitCommon", "type": {
>            "type": "map", "values":"string"}},
>    {"name":"events",
>      "type": {
>         "type": "array",
>     "items":{
>     "name":"Event",
>     "type":"map",
>     "values":"string"}
>     }
>     }
>  ]
> }
>
>
> 1) Error: The method deepCopy(Schema,
> List<Map<CharSequence,CharSequence>>) is undefined for the type GenericData
> 2) And also observed there is some deprecated code.
>  @Deprecated public
> java.util.Map<java.lang.CharSequence,java.lang.CharSequence> VisitCommon;
>
> I used eclipse plugin as mentioned below.
> http://avro.apache.org/docs/1.7.6/mr.html
>
>
> I tried with different versions of avro-maven-plugin, with 1.7.5, 1.7.6
> and with jdk1.7.0_45 version.
>
> I am unable to resolve it.
>
> Error message is as below:
> [ERROR] symbol:   method
> deepCopy(org.apache.avro.Schema,java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)
> [ERROR] location: class org.apache.avro.generic.GenericData
>
>  Thanks & Regards,
> B Anil Kumar.
>