-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.NoSuchMethodError after protobuf version 3.3.0 #4521
Comments
It's likely that you are using "optimize_for = LITE_RUNTIME" in your proto: that is not supported in Java any more and you can either remove it or switch to use Java Lite protoc plugin. See: #4314 |
I don't know if I'm using optimize_for = LITE_RUNTIME. How can I verify that? |
Can you check if the .proto file that's used to generate TrackInfoProtos.java contains: option optimize_for = LITE_RUNTIME; ? |
I see. None of my proto files contain the option optimize_for, so I don't think that's the root cause. |
I found a work around: |
Hmm, then you can double check you are depending on the right version of protobuf runtime? The method is still there as far as I can tell: If you can provide a simple program that can reproduce the error, I can help take a look. |
@zoukyle I don't understand your comment about protobuf_3_5_0_20180413.tar.gz. What is that? |
@xfxyjwf I had to replace the addAll function in the file java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java (v3.5 version) with the same function in v3.3 version to make it work. |
I get the same problem and I find that this is caused by jar conflict. In my case, my project depends both on protobuf-java-3.4.0 and protobuf-lite-3.0.1, both of them contain AbstractMessageLite$Builder.class, when compilng, protobuf-3.4.0.AbstractMessageLite$Builder is used, and when running, protobuf-lite-3.0.1.AbstractMessageLite$Builder is used
in protobuf-3.4.0.AbstractMessageLite$Builder.class:
and in my Inquiry.class:
look at this line
now u see how this error occurred. As for your question, why 3.2.0 and 3.3.0 works fine, but 3.4.0 throws an error.
In 3.4.0.:
So it's the same as what I mentioned before. |
@CageSama Thanks a lot for your explanation. It helped a lot. |
Hi, java.lang.NoSuchMethodError: 'void com.google.protobuf.AbstractMessageLite$Builder.addAll(java.lang.Iterable, java.util.List)' Please suggest what is the resolution. |
Is there anything preventing you from upgrading to the latest? We are up to 3.17 and this issue is from 2018. |
Hello , |
It works for version 3.3.0 and 3.2.0, but gives me the NoSuchMethod exception starting from version 3.4.0. Did anyone see this error before?
java.lang.NoSuchMethodError: com.google.protobuf.AbstractMessageLite$Builder.addAll(Ljava/lang/Iterable;Ljava/util/List;)V
at ai.deepmap.tracks.TrackInfoProtos$TrackInfo$Builder.addAllImageDirs(TrackInfoProtos.java:10947)
at ai.deepmap.servers.track_data_server.RpcTrackDataManagerStaticFilesTest.testGetTrackByNameSuccess(RpcTrackDataManagerStaticFilesTest.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at com.google.testing.junit.runner.internal.junit4.CancellableRequestFactory$CancellableRunner.run(CancellableRequestFactory.java:89)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
at com.google.testing.junit.runner.junit4.JUnit4Runner.run(JUnit4Runner.java:112)
at com.google.testing.junit.runner.BazelTestRunner.runTestsInSuite(BazelTestRunner.java:144)
at com.google.testing.junit.runner.BazelTestRunner.main(BazelTestRunner.java:82)
The text was updated successfully, but these errors were encountered: