3

I just ran into the problem where a reference to a ProtocolStringList caused a class not found error inside the generated code created by protoc.

In this case I got an Eclipse error:

com.google.protobuf.ProtocolStringList cannot be resolved to a type

I expect it could also show as a:

java.lang.NoClassDefFoundError: com/google/protobuf/ProtocolStringList
Tim B
  • 40,716
  • 16
  • 83
  • 128

1 Answers1

6

I couldn't find an answer to this on Stack Overflow so I'm posting it here.

It turns out this is caused by using later versions of protoc (2.6.1 in this case) with older versions of protobuf-java*.jar. (2.5.0 in this case).

Tim B
  • 40,716
  • 16
  • 83
  • 128
  • 1
    could you elaborate? so what you did to resolve the problem? Did a upgrade or downgrade? – Thariq Nugrohotomo Mar 31 '16 at 09:59
  • 1
    @ThariqNugrohotomo Yep. Just make sure the version of your jar and protoc are the same, you can move either in either direction so long as you run protoc with the same version as the jar you then run the code with. – Tim B Mar 31 '16 at 12:49