These errors appear to be caused by attempting to use an Avro-generated class where a Thrift or Protobuf-generated class is required. The Thrift and Protobuf support in Avro permits you to read and write instances of classes generated by the Thrift and Protobuf compilers as Avro-format data. It does not permit you to read and write Thrift and Protobuf-format data using classes generated from an Avro schema.
Doug On Fri, Jun 14, 2013 at 1:30 AM, Shlok Thakur <[email protected]> wrote: > Hi, > > > > In my Java application,I want to provide support for Avro, Thrift and > Protobuf. I am using java classes generated by avro schema and avro idl. > When I use ProtoBufDatumReader and ProtoBufDatumWriter classes to support > encode and decode Protobuf content. I get following exception: > > java.lang.RuntimeException: java.lang.NoSuchMethodException: > org.openrtb.common.api.BidRequest.getDescriptor() > > at > org.apache.avro.protobuf.ProtobufData.getSchema(ProtobufData.java:181) > > at > org.apache.avro.protobuf.ProtobufDatumWriter.<init>(ProtobufDatumWriter.java:36) > > at > org.openrtb.dsp.core.DemandSideServerTest.writeBidRequest(DemandSideServerTest.java:293) > > at > org.openrtb.dsp.core.DemandSideServerTest.protobufRespondTest(DemandSideServerTest.java:263) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) > > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) > > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) > > at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) > > at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) > > at > org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) > > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) > > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) > > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) > > > > Similarly Thrift content type is also not working for me. Following is the > exception: > > java.lang.NullPointerException: null of org.openrtb.common.api.BidRequest > > at > org.apache.avro.generic.GenericDatumWriter.npe(GenericDatumWriter.java:93) > > at > org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:87) > > at > org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:58) > > at > org.openrtb.dsp.core.DemandSideServerTest.writeBidRequest(DemandSideServerTest.java:295) > > at > org.openrtb.dsp.core.DemandSideServerTest.thriftRespondTest(DemandSideServerTest.java:275) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > > > pls find the attachment to complete stack trace for Protobuf & Thirft issue > > Can you pls advice and help me to resolve this issue. > > > > Regards > > Shlok Thakur
