Hi,
I'm having some problems at runtime with some of my generated protocol buffer classes.
My project layout is as follows:
module/ protobuf-api/ proto/ com/foo/api/Service.proto com/foo/shared/Shared.proto org/bar/api/Message1.proto org/bar/api/Message2.proto
The Service.proto file depends on Shared.proto and some of the Message*.proto files. From the protobuf-api directory, I run the following command to compile:
find . -name *.proto -exec protoc --java_out=java -I=proto {} \;
When I attempt to run my Service, I get the following exception:
java.lang.ExceptionInInitializerError at com.linkedin.history.api.protobuf.HistoryServiceProtos$HistoryServiceQuery.(HistoryServiceProtos.java:544) at com.linkedin.history.api.serializer.HistoryServiceSerializer.serialize(HistoryServiceSerializer.java:47) at test.history.serializer.TestSerializer.testHistoryServiceQuery(TestSerializer.java:38) at test.fwk.util.core.BaseTestSuiteCore.run(BaseTestSuiteCore.java:304) at test.fwk.util.core.BaseTestSuiteConf.run(BaseTestSuiteConf.java:186) at test.fwk.lispring.BaseTestSuite.run(BaseTestSuite.java:232) at test.fwk.lispring.BaseTestSuite.callAppropriateRun(BaseTestSuite.java:265) at test.fwk.util.core.BaseTestSuiteCore.run(BaseTestSuiteCore.java:199) Caused by: java.lang.IllegalArgumentException: Invalid embedded descriptor for "com/linkedin/history/api/protobuf/HistoryService.proto". at com.google.protobuf.Descriptors$FileDescriptor.internalBuildGeneratedFileFrom(Descriptors.java:268) at com.linkedin.history.api.protobuf.HistoryServiceProtos.(HistoryServiceProtos.java:1794) Caused by: com.google.protobuf.Descriptors$DescriptorValidationException: com/linkedin/history/api/protobuf/HistoryService.proto: Dependencies passed to FileDescriptor.buildFrom() don't match those listed in the FileDescriptorProto. at com.google.protobuf.Descriptors$FileDescriptor.buildFrom(Descriptors.java:221) at com.google.protobuf.Descriptors$FileDescriptor.internalBuildGeneratedFileFrom(Descriptors.java:266)
I've read the post here but I think I'm doing everything correctly. Any suggestions on why I'm having the initializer errors? I'm compiling everything with the same -I flag.