You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by "Gorman,Will" <WG...@CERNER.COM> on 2014/04/29 17:26:57 UTC

Problem with ProtobufDatumReader

I'm having some difficulty using avro-protobuf  and I'm not sure what I'm doing wrong.  I keep getting a ClassCastException that a Builder cannot be cast to a Message whenever I try to deserialize an object with the ProtobufDatumReader after it was serialized with the ProtobufDatumWriter.  I've looked through the code a bit in ProtobufData and GenericDatumReader but I'm not sure how it's supposed to work because it appears to just be creating a new builder and then passing it to a method that attempts to cast it to a message.  I've got a small example project here (https://bitbucket.org/willgorman/avro-proto-test) with a test that recreates the error.  I've been able to do the same thing successfully using avro-thrift.  Is there anything that I'm doing incorrectly here?

CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

Re: Problem with ProtobufDatumReader

Posted by "Gorman,Will" <WG...@CERNER.COM>.
Nevermind, I didn't realize that the first argument to the reader could be null.  Oops.  

On Apr 29, 2014, at 10:26 AM, "Gorman,Will" <WG...@CERNER.COM>
 wrote:

> I'm having some difficulty using avro-protobuf  and I'm not sure what I'm doing wrong.  I keep getting a ClassCastException that a Builder cannot be cast to a Message whenever I try to deserialize an object with the ProtobufDatumReader after it was serialized with the ProtobufDatumWriter.  I've looked through the code a bit in ProtobufData and GenericDatumReader but I'm not sure how it's supposed to work because it appears to just be creating a new builder and then passing it to a method that attempts to cast it to a message.  I've got a small example project here (https://bitbucket.org/willgorman/avro-proto-test) with a test that recreates the error.  I've been able to do the same thing successfully using avro-thrift.  Is there anything that I'm doing incorrectly here?
> 
> CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.