1

Using Avro for serializing data to byte[] and deserializing data. https://cwiki.apache.org/confluence/display/AVRO/FAQ#FAQ-HowcanIserializedirectlyto/fromabytearray? shows sample usage.

SpecificDatumReader<User> reader = new SpecificDatumReader<User>(User.getClassSchema());

The above line is causing the following error

IllegalAccessError: tried to access method org.apache.avro.specific.SpecificData.<init>() from class com.abc.schema.generated.User

Any pointers to what might be going wrong here? No errors seen at compile time.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
pc70
  • 681
  • 1
  • 14
  • 28

2 Answers2

1

This is likely due to you having an older version of Avro in your classpath. To check, run your program with the -verbose:class parameter and look for instance of SpecificData in the output. Example:

 java -verbose:class -jar your_jar.jar
Kien Truong
  • 11,179
  • 2
  • 30
  • 36
0

Changing the class loading from parent-first to child-first fixed this for me