-
Notifications
You must be signed in to change notification settings - Fork 32
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
NoSuchMethod error with Java SDK basic project #104
Comments
Hi @franck102 - Take a look at this issue #100 We are still assessing this internally, but your issue here seems similar. Let me know if you think something else is going on here! |
Hi @zenmasterjobo , this is neither the same missing method nor the same library, so I doubt the issues are related. As you can see the Square SDK depends on io.apimatic:okhttp-client-adapter:jar:0.1.6 which generates code trying to call okhttp's RequestBody.create method with arguments in the wrong order... something is wrong with the dependency tree below. It is very possible that the problem comes from apimatic or okhttp3, but I don't have a workaround at this point...
|
Hi @zeppelinux , Could you post your dependency tree? I did try okhttp 4.11.0 and that didn't help... not surprisingly since the create method expects the media type as the first argument. The problem seems to come from io.apimatic.okhttpclient.adapter.OkClient.convertRequest calling create with an old signature, but I can't find a more recent version of io.apimatic:okhttp-client-adapter. |
Hey @franck102 there is some weirdness going on in the square pom. I spent some time trying to get to the bottom of it, but didn't solve the root cause. |
Thanks @zeppelinux , I finally managed to make this work thanks in part to your suggestions.
|
@franck102 I'm glad to hear my suggestion helped! I don't see any exclusions in your snippet though... Are you sure you are not getting two okhttp jars in the classpath? |
🎉 @zeppelinux Thank you very much for contributing your thoughts and guidance on this!! |
No worries @zenmasterjobo, it's all what Open Source is about, right? 🍻 |
I do have the exclusions you suggested, but in <dependencies> - they won't be taken into account in the dependencyManagement section (see the maven docs). Quarkus anyway never included two jars for a given maven coordinate; but what I can recommend if you use Quarkus is to go check the target/quarkus-app/lib/main directory for the jars actually included in the Quarkus runtime, as opposed to trusting the output of I am not out of the woods yet since there seems to be some kind of interaction between the okhttp and okhttp3 libraries (or more likely their transitive dependencies), my Square API calls only work if I break the SendinBlue APIs by adding those exclusions:
It may be that a comon okio version solves the issue, but I haven't had time to test that yet. |
Hi @franck102, the dependencyManagement exclusions work as expected as long as they applied not to import. I confirmed this by looking at the target/uarkus-app/lib. |
Describe the bug
A basic java SDK project trying to create a location generates an okhttp NoSuchMethodError with the first payment API request.
Expected behavior
The
_client.getLocationsApi().createLocation(request)
call should succeed.To Reproduce
Steps to reproduce the bug:
Square SDK version
** What I tried **
I tried downgrading to 28.0.0.20230419 (as shown in the dependency tree below), same exception.
By default there is a dependency convergence issue with io.apimatic:io.apimatic; adding this entry in dependencyManagement solves the convergence issue, but the exception still occurs:
** What I tried: without dependency convergence **
Exception raised:
Maven dependency tree:
The text was updated successfully, but these errors were encountered: