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: com.google.common.base.Preconditions.checkArgument #5258
Comments
I'm not familiar with how Matlab interacts with Java, so perhaps you can answer some questions:
|
I am using the collected jars that were downloaded and built by gradle. Matlab has a classpath.txt file which you list all the jars that are to be part of the classpath. So see below for all the jars that I got from gradle and have added to matlab classpath. I did verify that I could build an example grpc client using just this jar directory.
|
@CptanPanic The "NoClassDefFoundError" is almost certainly due to static initialization failing due to io.netty not being present. Are the dependencies of gRPC also present on the classpath? (particularly netty and guava?) |
@carl-mastrangelo , are there more depencies for netty and guava that are not part of the above list? So I see that only guava-26.0-android.jar, should there be another more general guava? Also there are netty-*.jar files. |
d'oh! You are right, I only read the "grpc-java-jars" part. Another dumb question: are there multiple class loaders at play? The System class loader may not be the one you are using. If are using jdk9+, I think you can set |
So here is the jars that were loaded for the standalone executable. But overall there is not any jars except the rt.jar ones that are needed that are not being loaded. /mnt/fileserver/myproject/grpc-java-jars/grpc-context-1.17.1.jar] |
I have been working with Mathworks, and it turns out this is a problem with different versions of guava being used for my library, and matlab's internal use. They said it might work if gRPC used guava v24, which I don't think is possible anymore. |
This seems like a problem with the Mathworks platform, as it exposes its dependencies in the ClassPath. @CptanPanic, you may try making a "uber" jar containing your code and your dependencies and then shading Guava; that may have success, but would also be a bit painful to get all the configuration right. But it doesn't seem there's much more we can do to help you. |
Please answer these questions before submitting your issue.
What version of gRPC are you using?
1.17.2, built jars, etc using gradle. Java 1.8.0
What did you expect to see?
I am unable to create simple grpc objects, both in Matlab and another proprietary java application and get similar NoSuchMethodError errors.
Issue Description
So initially I am trying to get grpc-java to run in matlab, but when I tried 'o = io.grpc.ManagedChannelBuilder.forAddress('localhost', 5001)' I get the following error:
What is interesting, I was able to get past that initial error by adding 'import io.grpc.Metadata', but still ended up with the following error:
Which didn't make any sense to me since I can build and run code on command line using same jars. So I submitted a ticket to Mathworks, and they are looking at it.
But what led me to open this ticket, is in parellel we are adding grpc-java support to another java product, that allows us to create our own plugins, and after adding grpc-java to our code, now on startup we now get the following similar error in this tool, so now I think this isn't a Matlab thing, but something else that is wrong either with something I am doing, or the code. Any ideas?
The text was updated successfully, but these errors were encountered: