Running a sample AddPerson.java example - Fails giving "Protocol message tag had invalid wire type"

5,396 views
Skip to first unread message

Dhaval Kotecha

unread,
Jul 1, 2013, 6:00:08 PM7/1/13
to prot...@googlegroups.com
Hi All,

I am a newbie to Protocol Buffers. I am trying to run the AddPerson example, and it fails giving me the error as mentioned below with the whole stacktrace.

Exception in thread "main" com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type.
at com.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java:99)
at com.google.protobuf.UnknownFieldSet$Builder.mergeFieldFrom(UnknownFieldSet.java:498)
at com.google.protobuf.GeneratedMessage.parseUnknownField(GeneratedMessage.java:193)
at com.example.tutorial.AddressBookProtos$AddressBook.<init>(AddressBookProtos.java:1878)
at com.example.tutorial.AddressBookProtos$AddressBook.<init>(AddressBookProtos.java:1861)
at com.example.tutorial.AddressBookProtos$AddressBook$1.parsePartialFrom(AddressBookProtos.java:1925)
at com.example.tutorial.AddressBookProtos$AddressBook$1.parsePartialFrom(AddressBookProtos.java:1)
at com.example.tutorial.AddressBookProtos$AddressBook$Builder.mergeFrom(AddressBookProtos.java:2231)
at com.example.tutorial.AddressBookProtos$AddressBook$Builder.mergeFrom(AddressBookProtos.java:1)
at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:337)
at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:267)
at com.google.protobuf.AbstractMessageLite$Builder.mergeFrom(AbstractMessageLite.java:210)
at com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:904)
at AddPerson.main(AddPerson.java:74)

I am giving the "\protobuf-2.5.0\examples\addressbook.proto" as an argument for ADDRESS_BOOK_FILE.

What am I missing out here?

Thanks,
Dhaval

Ilia Mirkin

unread,
Jul 2, 2013, 1:34:52 PM7/2/13
to Dhaval Kotecha, prot...@googlegroups.com
I think it wants a file with proto data, not the proto description.
Also it wants it proto-encoded, not text-encoded.
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+u...@googlegroups.com.
> To post to this group, send email to prot...@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages