Amareswar
Amareswar

Reputation: 2064

VerifyError using protobuf 2.4.1

I am getting below error when trying to create a newBuilder() object for a given protobuf class. Having protobuf-java-2.4.1.jar in the classpath.

Same is working on the server side but fails on the client.

java.lang.VerifyError: Bad return type
Exception Details:
  Location:
    packagename.QuerySpecProtos$QuerySpec$Builder.clone()Lcom/google/protobuf/AbstractMessageLite$Builder; @4: areturn
  Reason:
    Type 'packagename.QuerySpecProtos$QuerySpec$Builder' (current frame, stack[0]) is not assignable to 'com/google/protobuf/AbstractMessageLite$Builder' (from method signature)
  Current Frame:
    bci: @4
    flags: { }
    locals: { 'packagename.QuerySpecProtos$QuerySpec$Builder' }
    stack: { 'packagename.QuerySpecProtos$QuerySpec$Builder' }
  Bytecode:
    0000000: 2ab6 0062 b0                           

Upvotes: 0

Views: 2599

Answers (1)

Kenton Varda
Kenton Varda

Reputation: 45141

Looks like a version mismatch. You need to be sure that both:

  1. You use the same jar version when compiling and running.
  2. You use the same version of protoc to match the jar.

Upvotes: 2

Related Questions