Search code examples
javaprotoc

Why do I get an error with missing ProtocolStringList in google protobuf?


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

Solution

  • 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).