I have a web application that I run in windows and linux environment. On linux and linux only, I get the following exception:
Caused by: java.lang.IllegalArgumentException: Invalid embedded descriptor for "moop_shared.proto". at com.google.protobuf.Descriptors$FileDescriptor.internalBuildGeneratedFileFrom(Descriptors.java:301) ... Caused by: com.google.protobuf.Descriptors$DescriptorValidationException: moop_shared.proto: Dependencies passed to FileDescriptor.buildFrom() don't match those listed in the FileDescriptorProto. at com.google.protobuf.Descriptors$FileDescriptor.buildFrom(Descriptors.java:246) at com.google.protobuf.Descriptors$FileDescriptor.internalBuildGeneratedFileFrom(Descriptors.java:299) ...
So, I debugged it both locally and remotely, comparing the result. I can not understand the following:
Env:
Protobuf-java-2.5.0
java 7
In both cases, I run the same webapp, and I am in the same place in the code that com.google.protobuf.Descriptors.java#245 see code
For context
... for (int i = 0; i < proto.getDependencyCount(); i++) { HERE --> if (!dependencies[i].getName().equals(proto.getDependency(i))) { throw new DescriptorValidationException(result, "Dependencies passed to FileDescriptor.buildFrom() don't match " + "those listed in the FileDescriptorProto."); } } ...
And here is the information from the debugger:
Window:
dependencies[i].getName() = { java.lang.String@3681 }"descriptor.proto" proto.getDependency(i) = { java.lang.String@3682 }"descriptor.proto" dependencies[i].getClass().getProtectionDomain().getCodeSource().getLocation().getPath() = { java.lang.String@3846 }"/C:/Apps/Apache/jakarta/tomcat/webapps/ROOT/WEB-INF/lib/protobuf-java-2.5.0.jar"
Linux:
dependencies[i].getName() = { java.lang.String@2444 }"google/protobuf/descriptor.proto" proto.getDependency(i) = { java.lang.String@2445 }"descriptor.proto" dependencies[i].getClass().getProtectionDomain().getCodeSource().getLocation().getPath() = { java.lang.String@2608 }"/tmp/jetty-0.0.0.0-8080-cnc-webapp-1.6.3-SNAPSHOT.war-_-any-/webapp/WEB-INF/lib/protobuf-java-2.5.0.jar"
Thus, both dependencies are loaded from protobuf jar, which is a byte index (checked), but the result of dependencies[i].getName() is different from what Linux calls DescriptorValidationException . This is what is next to my understanding.
Any help would be greatly appreciated.
source share