square / square-java-sdk

Java client library for the Square API
https://developer.squareup.com
Other
59 stars 32 forks source link

NoSuchMethod error with Java SDK basic project #104

Open franck102 opened 1 year ago

franck102 commented 1 year ago

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:

_client = new SquareClient.Builder()
                .environment(Environment.SANDBOX).accessToken(accessToken).build();
CreateLocationRequest request = new CreateLocationRequest.Builder().
                            location(new Location.Builder().name(venue.getName()).
                                    build()).build();
_client.getLocationsApi().createLocation(request)

Square SDK version

 <dependency>
      <groupId>com.squareup</groupId>
      <artifactId>square</artifactId>
      <version>29.0.0.20230517</version>
    </dependency>

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:

 <dependency>
        <groupId>io.apimatic</groupId>
        <artifactId>io.apimatic</artifactId>
        <version>0.1.7</version>
        <scope>compile</scope>
      </dependency>

What I tried: without dependency convergence

Exception raised:


 17:10:33 ERROR [or.jb.re.re.co.co.AbstractResteasyReactiveContext] (executor-thread-3) Request failed: java.lang.NoSuchMethodError: 'okhttp3.RequestBody okhttp3.RequestBody.create(byte[], okhttp3.MediaType)'
    at io.apimatic.okhttpclient.adapter.OkClient.convertRequest(OkClient.java:420)
    at io.apimatic.okhttpclient.adapter.OkClient.execute(OkClient.java:258)
    at io.apimatic.core.ApiCall.execute(ApiCall.java:65)
    at com.squareup.square.api.DefaultLocationsApi.createLocation(DefaultLocationsApi.java:98)

Maven dependency tree:

[INFO] --- dependency:2.8:tree (default-cli) @ ep-payment ---
[WARNING] Parameter 'localRepository' is deprecated core expression; Avoid use of ArtifactRepository type. If you need access to local repository, switch to '${repositorySystemSession}' expression and get LRM from it instead.
[INFO] com.easypass:ep-payment:jar:0.5.34
[INFO] +- com.easypass:ep-common:jar:0.5.34:compile
[INFO] |  +- com.googlecode.libphonenumber:libphonenumber:jar:8.13.2:compile
[INFO] |  +- io.quarkus:quarkus-oidc:jar:2.14.2.Final:compile
[INFO] |  |  +- io.quarkus:quarkus-vertx-http:jar:2.14.2.Final:compile
[INFO] |  |  |  +- io.quarkus:quarkus-security-runtime-spi:jar:2.14.2.Final:compile
[INFO] |  |  |  +- io.quarkus:quarkus-credentials:jar:2.14.2.Final:compile
[INFO] |  |  |  +- io.quarkus:quarkus-vertx-http-dev-console-runtime-spi:jar:2.14.2.Final:compile
[INFO] |  |  |  +- io.quarkus.security:quarkus-security:jar:1.1.4.Final:compile
[INFO] |  |  |  +- io.smallrye.reactive:smallrye-mutiny-vertx-web:jar:2.27.0:compile
[INFO] |  |  |  |  +- io.smallrye.reactive:smallrye-mutiny-vertx-web-common:jar:2.27.0:compile
[INFO] |  |  |  |  +- io.smallrye.reactive:smallrye-mutiny-vertx-auth-common:jar:2.27.0:compile
[INFO] |  |  |  |  +- io.smallrye.reactive:smallrye-mutiny-vertx-bridge-common:jar:2.27.0:compile
[INFO] |  |  |  |  \- io.smallrye.reactive:smallrye-mutiny-vertx-uri-template:jar:2.27.0:compile
[INFO] |  |  |  |     \- io.vertx:vertx-uri-template:jar:4.3.4:compile
[INFO] |  |  |  +- io.vertx:vertx-web:jar:4.3.4:compile
[INFO] |  |  |  |  +- io.vertx:vertx-web-common:jar:4.3.4:compile
[INFO] |  |  |  |  +- io.vertx:vertx-auth-common:jar:4.3.4:compile
[INFO] |  |  |  |  \- io.vertx:vertx-bridge-common:jar:4.3.4:compile
[INFO] |  |  |  \- io.github.crac:org-crac:jar:0.1.1:compile
[INFO] |  |  +- io.quarkus:quarkus-security:jar:2.14.2.Final:compile
[INFO] |  |  |  \- jakarta.interceptor:jakarta.interceptor-api:jar:1.2.5:compile
[INFO] |  |  +- io.quarkus:quarkus-jsonp:jar:2.14.2.Final:compile
[INFO] |  |  |  \- org.glassfish:jakarta.json:jar:1.1.6:compile
[INFO] |  |  +- io.quarkus:quarkus-oidc-common:jar:2.14.2.Final:compile
[INFO] |  |  |  +- io.smallrye.reactive:smallrye-mutiny-vertx-web-client:jar:2.27.0:compile
[INFO] |  |  |  |  \- io.vertx:vertx-web-client:jar:4.3.4:compile
[INFO] |  |  |  \- io.quarkus:quarkus-smallrye-jwt-build:jar:2.14.2.Final:compile
[INFO] |  |  |     \- io.smallrye:smallrye-jwt-build:jar:3.5.4:compile
[INFO] |  |  +- io.smallrye:smallrye-jwt:jar:3.5.4:compile
[INFO] |  |  |  +- org.eclipse.microprofile.config:microprofile-config-api:jar:2.0.1:compile
[INFO] |  |  |  +- org.bitbucket.b_c:jose4j:jar:0.8.0:compile
[INFO] |  |  |  \- io.smallrye:smallrye-jwt-common:jar:3.5.4:compile
[INFO] |  |  \- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  +- io.quarkus:quarkus-resteasy-reactive-jackson:jar:2.14.2.Final:compile
[INFO] |  |  +- io.quarkus:quarkus-resteasy-reactive:jar:2.14.2.Final:compile
[INFO] |  |  |  +- io.quarkus:quarkus-resteasy-reactive-common:jar:2.14.2.Final:compile
[INFO] |  |  |  |  \- io.quarkus.resteasy.reactive:resteasy-reactive-common:jar:2.14.2.Final:compile
[INFO] |  |  |  |     \- io.quarkus.resteasy.reactive:resteasy-reactive-common-types:jar:2.14.2.Final:compile
[INFO] |  |  |  \- io.quarkus.resteasy.reactive:resteasy-reactive-vertx:jar:2.14.2.Final:compile
[INFO] |  |  |     +- io.quarkus.resteasy.reactive:resteasy-reactive:jar:2.14.2.Final:compile
[INFO] |  |  |     \- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec:jar:2.0.1.Final:compile
[INFO] |  |  \- io.quarkus:quarkus-resteasy-reactive-jackson-common:jar:2.14.2.Final:compile
[INFO] |  |     +- io.quarkus.resteasy.reactive:resteasy-reactive-jackson:jar:2.14.2.Final:compile
[INFO] |  |     \- io.quarkus:quarkus-jackson:jar:2.14.2.Final:compile
[INFO] |  |        +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.4:compile
[INFO] |  |        +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.13.4:compile
[INFO] |  |        \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.13.4:compile
[INFO] |  +- org.apache.commons:commons-jcs3-core:jar:3.1:compile
[INFO] |  +- org.eclipse.microprofile.jwt:microprofile-jwt-auth-api:jar:1.2:compile
[INFO] |  \- org.mybatis:mybatis:jar:3.5.10:compile
[INFO] +- com.easypass:ep-core:jar:0.5.34:compile
[INFO] |  +- at.favre.lib:bcrypt:jar:0.9.0:compile
[INFO] |  |  \- at.favre.lib:bytes:jar:1.3.0:compile
[INFO] |  +- commons-io:commons-io:jar:2.11.0:compile
[INFO] |  +- commons-validator:commons-validator:jar:1.7:compile
[INFO] |  |  +- commons-beanutils:commons-beanutils:jar:1.9.4:compile
[INFO] |  |  +- commons-digester:commons-digester:jar:2.1:compile
[INFO] |  |  \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |  +- io.quarkiverse.mybatis:quarkus-mybatis:jar:1.0.4:compile
[INFO] |  |  \- io.quarkus:quarkus-agroal:jar:2.14.2.Final:compile
[INFO] |  |     +- io.quarkus:quarkus-datasource:jar:2.14.2.Final:compile
[INFO] |  |     +- io.agroal:agroal-api:jar:1.16:compile
[INFO] |  |     +- io.agroal:agroal-narayana:jar:1.16:compile
[INFO] |  |     \- io.agroal:agroal-pool:jar:1.16:compile
[INFO] |  +- io.quarkus:quarkus-jdbc-postgresql:jar:2.14.2.Final:compile
[INFO] |  |  \- org.postgresql:postgresql:jar:42.5.1:compile
[INFO] |  +- io.quarkus:quarkus-keycloak-admin-client-reactive:jar:2.14.2.Final:compile
[INFO] |  |  +- io.quarkus:quarkus-rest-client-reactive-jackson:jar:2.14.2.Final:compile
[INFO] |  |  |  \- io.quarkus:quarkus-rest-client-reactive:jar:2.14.2.Final:compile
[INFO] |  |  |     +- io.quarkus:quarkus-jaxrs-client-reactive:jar:2.14.2.Final:compile
[INFO] |  |  |     |  \- io.quarkus.resteasy.reactive:resteasy-reactive-client:jar:2.14.2.Final:compile
[INFO] |  |  |     +- io.quarkus:quarkus-smallrye-stork:jar:2.14.2.Final:compile
[INFO] |  |  |     +- io.quarkus:quarkus-rest-client-config:jar:2.14.2.Final:compile
[INFO] |  |  |     +- io.smallrye.stork:stork-api:jar:1.3.0:compile
[INFO] |  |  |     +- io.smallrye.stork:stork-core:jar:1.3.0:compile
[INFO] |  |  |     \- org.eclipse.microprofile.rest.client:microprofile-rest-client-api:jar:2.0:compile
[INFO] |  |  +- org.keycloak:keycloak-core:jar:19.0.3:compile
[INFO] |  |  |  \- org.keycloak:keycloak-common:jar:19.0.3:compile
[INFO] |  |  +- com.sun.activation:jakarta.activation:jar:1.2.1:compile
[INFO] |  |  +- org.keycloak:keycloak-admin-client:jar:19.0.3:compile
[INFO] |  |  +- org.jboss.logging:commons-logging-jboss-logging:jar:1.0.0.Final:compile
[INFO] |  |  \- io.quarkus:quarkus-keycloak-admin-client-common:jar:2.14.2.Final:compile
[INFO] |  +- io.quarkus:quarkus-liquibase:jar:2.14.2.Final:compile
[INFO] |  |  +- org.liquibase:liquibase-core:jar:4.16.1:compile
[INFO] |  |  |  \- com.opencsv:opencsv:jar:5.6:compile
[INFO] |  |  |     +- org.apache.commons:commons-text:jar:1.10.0:compile
[INFO] |  |  |     \- org.apache.commons:commons-collections4:jar:4.4:compile
[INFO] |  |  +- org.osgi:osgi.core:jar:6.0.0:compile
[INFO] |  |  +- org.yaml:snakeyaml:jar:1.33:compile
[INFO] |  |  +- io.quarkus:quarkus-jaxb:jar:2.14.2.Final:compile
[INFO] |  |  |  +- io.quarkus:quarkus-jaxp:jar:2.14.2.Final:compile
[INFO] |  |  |  \- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.3_spec:jar:2.0.0.Final:compile
[INFO] |  |  \- io.quarkus:quarkus-datasource-common:jar:2.14.2.Final:compile
[INFO] |  +- io.quarkus:quarkus-smallrye-health:jar:2.14.2.Final:compile
[INFO] |  |  +- io.smallrye:smallrye-health:jar:3.3.0:compile
[INFO] |  |  |  +- org.eclipse.microprofile.health:microprofile-health-api:jar:3.1:compile
[INFO] |  |  |  \- io.smallrye:smallrye-health-api:jar:3.3.0:compile
[INFO] |  |  \- io.smallrye:smallrye-health-provided-checks:jar:3.3.0:compile
[INFO] |  +- org.apache.commons:commons-csv:jar:1.9.0:compile
[INFO] |  \- org.mybatis.dynamic-sql:mybatis-dynamic-sql:jar:1.4.1:compile
[INFO] +- com.squareup:square:jar:29.0.0.20230517:compile
[INFO] |  +- io.apimatic:core-interfaces:jar:0.1.7:compile
[INFO] |  |  \- com.squareup.okhttp3:okhttp:jar:3.14.9:compile
[INFO] |  |     \- com.squareup.okio:okio:jar:1.17.2:compile
[INFO] |  +- io.apimatic:core:jar:0.4.5:compile (version selected from constraint [0.4,0.5))
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.4.2:compile
[INFO] |  |  +- junit:junit:jar:4.13.2:compile
[INFO] |  |  |  \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] |  |  +- javax.xml.bind:jaxb-api:jar:2.4.0-b180830.0359:compile
[INFO] |  |  |  \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] |  |  +- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3-b02:compile
[INFO] |  |  |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] |  |  |  +- org.glassfish.jaxb:txw2:jar:2.3.3-b02:compile
[INFO] |  |  |  \- com.sun.istack:istack-commons-runtime:jar:3.0.10:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-core:jar:2.13.4:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.4:compile
[INFO] |  |  +- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] |  |  \- org.glassfish:javax.json:jar:1.1.4:compile
[INFO] |  \- io.apimatic:okhttp-client-adapter:jar:0.1.6:compile (version selected from constraint [0.1,0.2))
[INFO] |     \- org.hamcrest:hamcrest-all:jar:1.3:compile
[INFO] +- io.quarkus:quarkus-arc:jar:2.14.2.Final:compile
[INFO] |  +- io.quarkus.arc:arc:jar:2.14.2.Final:compile
[INFO] |  |  +- jakarta.enterprise:jakarta.enterprise.cdi-api:jar:2.0.2:compile
[INFO] |  |  |  \- jakarta.el:jakarta.el-api:jar:3.0.3:compile
[INFO] |  |  +- io.smallrye.reactive:mutiny:jar:1.8.0:compile
[INFO] |  |  \- org.jboss.logging:jboss-logging:jar:3.5.0.Final:compile
[INFO] |  +- io.quarkus:quarkus-core:jar:2.14.2.Final:compile
[INFO] |  |  +- jakarta.inject:jakarta.inject-api:jar:1.0:compile
[INFO] |  |  +- io.quarkus:quarkus-ide-launcher:jar:2.14.2.Final:compile
[INFO] |  |  +- io.quarkus:quarkus-development-mode-spi:jar:2.14.2.Final:compile
[INFO] |  |  +- io.smallrye.config:smallrye-config:jar:2.12.1:compile
[INFO] |  |  |  \- io.smallrye.config:smallrye-config-core:jar:2.12.1:compile
[INFO] |  |  |     +- io.smallrye.common:smallrye-common-expression:jar:1.13.2:compile
[INFO] |  |  |     |  \- io.smallrye.common:smallrye-common-function:jar:1.13.2:compile
[INFO] |  |  |     +- io.smallrye.common:smallrye-common-classloader:jar:1.13.2:compile
[INFO] |  |  |     \- io.smallrye.config:smallrye-config-common:jar:2.12.1:compile
[INFO] |  |  +- org.jboss.logmanager:jboss-logmanager-embedded:jar:1.0.11:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging-annotations:jar:2.2.1.Final:compile
[INFO] |  |  +- org.jboss.threads:jboss-threads:jar:3.4.3.Final:compile
[INFO] |  |  +- org.graalvm.sdk:graal-sdk:jar:22.3.0:compile
[INFO] |  |  +- org.wildfly.common:wildfly-common:jar:1.5.4.Final-format-001:compile
[INFO] |  |  +- io.quarkus:quarkus-bootstrap-runner:jar:2.14.2.Final:compile
[INFO] |  |  \- io.quarkus:quarkus-fs-util:jar:0.0.9:compile
[INFO] |  \- org.eclipse.microprofile.context-propagation:microprofile-context-propagation-api:jar:1.2:compile
[INFO] +- io.quarkus:quarkus-narayana-jta:jar:2.14.2.Final:compile
[INFO] |  +- io.quarkus:quarkus-transaction-annotations:jar:2.14.2.Final:compile
[INFO] |  +- io.quarkus:quarkus-mutiny:jar:2.14.2.Final:compile
[INFO] |  |  +- io.quarkus:quarkus-smallrye-context-propagation:jar:2.14.2.Final:compile
[INFO] |  |  |  \- io.smallrye:smallrye-context-propagation:jar:1.2.2:compile
[INFO] |  |  |     +- io.smallrye:smallrye-context-propagation-api:jar:1.2.2:compile
[INFO] |  |  |     \- io.smallrye:smallrye-context-propagation-storage:jar:1.2.2:compile
[INFO] |  |  \- io.smallrye.reactive:mutiny-smallrye-context-propagation:jar:1.8.0:compile
[INFO] |  +- io.smallrye:smallrye-context-propagation-jta:jar:1.2.2:compile
[INFO] |  +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] |  +- io.smallrye.reactive:smallrye-reactive-converter-api:jar:2.7.0:compile
[INFO] |  |  \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] |  +- io.smallrye.reactive:smallrye-reactive-converter-mutiny:jar:2.7.0:compile
[INFO] |  +- org.jboss.narayana.jta:narayana-jta:jar:5.13.1.Final:compile
[INFO] |  |  +- org.jboss:jboss-transaction-spi:jar:7.6.0.Final:compile
[INFO] |  |  \- org.jboss.spec.javax.resource:jboss-connector-api_1.7_spec:jar:1.0.0.Final:compile
[INFO] |  \- org.jboss.narayana.jts:narayana-jts-integration:jar:5.13.1.Final:compile
[INFO] +- io.quarkus:quarkus-vertx:jar:2.14.2.Final:compile
[INFO] |  +- io.quarkus:quarkus-netty:jar:2.14.2.Final:compile
[INFO] |  |  +- io.netty:netty-codec:jar:4.1.82.Final:compile
[INFO] |  |  |  \- io.netty:netty-common:jar:4.1.82.Final:compile
[INFO] |  |  +- io.netty:netty-codec-http:jar:4.1.82.Final:compile
[INFO] |  |  +- io.netty:netty-codec-http2:jar:4.1.82.Final:compile
[INFO] |  |  +- io.netty:netty-handler:jar:4.1.82.Final:compile
[INFO] |  |  |  +- io.netty:netty-resolver:jar:4.1.82.Final:compile
[INFO] |  |  |  \- io.netty:netty-transport-native-unix-common:jar:4.1.82.Final:compile
[INFO] |  |  \- com.aayushatharva.brotli4j:brotli4j:jar:1.8.0:compile
[INFO] |  |     \- com.aayushatharva.brotli4j:native-osx-aarch64:jar:1.8.0:compile
[INFO] |  +- io.netty:netty-codec-haproxy:jar:4.1.82.Final:compile
[INFO] |  |  +- io.netty:netty-buffer:jar:4.1.82.Final:compile
[INFO] |  |  \- io.netty:netty-transport:jar:4.1.82.Final:compile
[INFO] |  +- io.smallrye.common:smallrye-common-annotation:jar:1.13.2:compile
[INFO] |  +- io.smallrye.common:smallrye-common-vertx-context:jar:1.13.2:compile
[INFO] |  |  +- io.vertx:vertx-core:jar:4.3.4:compile
[INFO] |  |  |  +- io.netty:netty-handler-proxy:jar:4.1.82.Final:compile
[INFO] |  |  |  |  \- io.netty:netty-codec-socks:jar:4.1.82.Final:compile
[INFO] |  |  |  \- io.netty:netty-resolver-dns:jar:4.1.82.Final:compile
[INFO] |  |  |     \- io.netty:netty-codec-dns:jar:4.1.82.Final:compile
[INFO] |  |  \- io.smallrye.common:smallrye-common-constraint:jar:1.13.2:compile
[INFO] |  +- io.quarkus:quarkus-vertx-latebound-mdc-provider:jar:2.14.2.Final:compile
[INFO] |  +- io.smallrye.reactive:smallrye-mutiny-vertx-core:jar:2.27.0:compile
[INFO] |  |  +- io.smallrye.reactive:smallrye-mutiny-vertx-runtime:jar:2.27.0:compile
[INFO] |  |  \- io.smallrye.reactive:vertx-mutiny-generator:jar:2.27.0:compile
[INFO] |  |     \- io.vertx:vertx-codegen:jar:4.3.4:compile
[INFO] |  \- io.smallrye:smallrye-fault-tolerance-vertx:jar:5.5.0:compile
[INFO] +- org.jboss.slf4j:slf4j-jboss-logmanager:jar:1.2.0.Final:compile
[INFO] +- io.quarkus:quarkus-junit5:jar:2.14.2.Final:test
[INFO] |  +- io.quarkus:quarkus-bootstrap-core:jar:2.14.2.Final:test
[INFO] |  |  +- io.quarkus:quarkus-bootstrap-app-model:jar:2.14.2.Final:test
[INFO] |  |  \- io.smallrye.common:smallrye-common-io:jar:1.13.2:compile
[INFO] |  +- org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.5:test
[INFO] |  +- io.quarkus:quarkus-test-common:jar:2.14.2.Final:test
[INFO] |  |  +- io.quarkus:quarkus-core-deployment:jar:2.14.2.Final:test
[INFO] |  |  |  +- org.aesh:readline:jar:2.2:test
[INFO] |  |  |  |  \- org.fusesource.jansi:jansi:jar:1.18:test
[INFO] |  |  |  +- org.aesh:aesh:jar:2.6:test
[INFO] |  |  |  +- io.quarkus.gizmo:gizmo:jar:1.4.0.Final:test
[INFO] |  |  |  |  \- org.ow2.asm:asm-util:jar:9.4:test
[INFO] |  |  |  |     \- org.ow2.asm:asm-analysis:jar:9.4:test
[INFO] |  |  |  +- org.ow2.asm:asm:jar:9.4:test
[INFO] |  |  |  +- org.ow2.asm:asm-commons:jar:9.4:test
[INFO] |  |  |  |  \- org.ow2.asm:asm-tree:jar:9.4:test
[INFO] |  |  |  +- io.quarkus:quarkus-class-change-agent:jar:2.14.2.Final:test
[INFO] |  |  |  +- io.quarkus:quarkus-devtools-utilities:jar:2.14.2.Final:test
[INFO] |  |  |  +- io.quarkus:quarkus-builder:jar:2.14.2.Final:test
[INFO] |  |  |  \- org.junit.platform:junit-platform-launcher:jar:1.9.1:test
[INFO] |  |  +- io.quarkus:quarkus-bootstrap-maven-resolver:jar:2.14.2.Final:test
[INFO] |  |  |  +- org.apache.maven:maven-embedder:jar:3.8.6:test
[INFO] |  |  |  |  +- org.apache.maven:maven-settings:jar:3.8.6:test
[INFO] |  |  |  |  +- org.apache.maven:maven-core:jar:3.8.6:test
[INFO] |  |  |  |  |  +- org.apache.maven:maven-artifact:jar:3.8.6:test
[INFO] |  |  |  |  |  \- org.codehaus.plexus:plexus-component-annotations:jar:2.1.0:test
[INFO] |  |  |  |  +- org.apache.maven:maven-plugin-api:jar:3.8.6:test
[INFO] |  |  |  |  +- org.apache.maven:maven-model:jar:3.8.6:test
[INFO] |  |  |  |  +- org.apache.maven:maven-model-builder:jar:3.8.6:test
[INFO] |  |  |  |  +- org.apache.maven:maven-builder-support:jar:3.8.6:test
[INFO] |  |  |  |  +- org.apache.maven.resolver:maven-resolver-api:jar:1.6.3:test
[INFO] |  |  |  |  +- org.apache.maven.resolver:maven-resolver-util:jar:1.6.3:test
[INFO] |  |  |  |  +- org.apache.maven.shared:maven-shared-utils:jar:3.3.4:test
[INFO] |  |  |  |  +- com.google.inject:guice:jar:no_aop:4.2.2:test
[INFO] |  |  |  |  |  \- com.google.guava:guava:jar:31.1-jre:test
[INFO] |  |  |  |  |     \- com.google.guava:failureaccess:jar:1.0.1:test
[INFO] |  |  |  |  +- org.codehaus.plexus:plexus-classworlds:jar:2.6.0:test
[INFO] |  |  |  |  +- org.codehaus.plexus:plexus-sec-dispatcher:jar:2.0:test
[INFO] |  |  |  |  +- org.codehaus.plexus:plexus-cipher:jar:2.0:test
[INFO] |  |  |  |  \- commons-cli:commons-cli:jar:1.4:test
[INFO] |  |  |  +- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.5:test
[INFO] |  |  |  +- org.apache.maven:maven-settings-builder:jar:3.8.6:test
[INFO] |  |  |  |  \- org.codehaus.plexus:plexus-interpolation:jar:1.26:test
[INFO] |  |  |  +- org.apache.maven:maven-resolver-provider:jar:3.8.6:test
[INFO] |  |  |  |  +- org.apache.maven:maven-repository-metadata:jar:3.8.6:test
[INFO] |  |  |  |  +- org.apache.maven.resolver:maven-resolver-spi:jar:1.6.3:test
[INFO] |  |  |  |  +- org.apache.maven.resolver:maven-resolver-impl:jar:1.6.3:test
[INFO] |  |  |  |  \- org.codehaus.plexus:plexus-utils:jar:3.3.0:test
[INFO] |  |  |  +- org.apache.maven.resolver:maven-resolver-connector-basic:jar:1.6.3:test
[INFO] |  |  |  +- org.apache.maven.resolver:maven-resolver-transport-wagon:jar:1.6.3:test
[INFO] |  |  |  +- org.apache.maven.wagon:wagon-http:jar:3.5.1:test
[INFO] |  |  |  |  +- org.apache.maven.wagon:wagon-http-shared:jar:3.5.1:test
[INFO] |  |  |  |  \- org.apache.maven.wagon:wagon-provider-api:jar:3.5.1:test
[INFO] |  |  |  \- org.apache.maven.wagon:wagon-file:jar:3.5.1:test
[INFO] |  |  +- io.quarkus:quarkus-bootstrap-gradle-resolver:jar:2.14.2.Final:test
[INFO] |  |  \- io.smallrye:jandex:jar:3.0.4:compile
[INFO] |  +- io.quarkus:quarkus-junit5-properties:jar:2.14.2.Final:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.9.1:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.9.1:test
[INFO] |  |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |  |  |  +- org.junit.platform:junit-platform-commons:jar:1.9.1:test
[INFO] |  |  |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.9.1:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.9.1:test
[INFO] |  |     \- org.junit.platform:junit-platform-engine:jar:1.9.1:test
[INFO] |  \- com.thoughtworks.xstream:xstream:jar:1.4.19:test
[INFO] |     \- io.github.x-stream:mxparser:jar:1.2.2:test
[INFO] |        \- xmlpull:xmlpull:jar:1.1.3.1:test
[INFO] \- io.rest-assured:rest-assured:jar:5.1.0:test
[INFO]    +- org.apache.groovy:groovy:jar:4.0.1:test
[INFO]    +- org.apache.groovy:groovy-xml:jar:4.0.1:test
[INFO]    +- org.apache.httpcomponents:httpclient:jar:4.5.13:test
[INFO]    |  +- org.apache.httpcomponents:httpcore:jar:4.4.15:test
[INFO]    |  +- commons-logging:commons-logging:jar:1.2:test
[INFO]    |  \- commons-codec:commons-codec:jar:1.15:test
[INFO]    +- org.apache.httpcomponents:httpmime:jar:4.5.13:test
[INFO]    +- org.hamcrest:hamcrest:jar:2.1:test
[INFO]    +- org.ccil.cowan.tagsoup:tagsoup:jar:1.2.1:test
[INFO]    +- io.rest-assured:json-path:jar:5.1.0:test
[INFO]    |  +- org.apache.groovy:groovy-json:jar:4.0.1:test
[INFO]    |  \- io.rest-assured:rest-assured-common:jar:5.1.0:test
[INFO]    \- io.rest-assured:xml-path:jar:5.1.0:test
[INFO]       \- org.apache.commons:commons-lang3:jar:3.12.0:compile
zenmasterjobo commented 1 year ago

Hi @franck102 -

Take a look at this issue https://github.com/square/square-java-sdk/issues/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!

franck102 commented 1 year ago

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...

[INFO] +- com.squareup:square:jar:29.0.0.20230517:compile
[INFO] |  +- io.apimatic:core-interfaces:jar:0.1.7:compile (version selected from constraint [0.1,0.2))
[INFO] |  |  \- com.squareup.okhttp3:okhttp:jar:3.14.9:compile
[INFO] |  +- io.apimatic:core:jar:0.4.5:compile (version selected from constraint [0.4,0.5))
[INFO] |  \- io.apimatic:okhttp-client-adapter:jar:0.1.6:compile (version selected from constraint [0.1,0.2))
zeppelinux commented 1 year ago

I had the same issue (before facing #100). You can have a look at my pom.xml file (relevant snippet is provided in #100 as well) for a workaround that works for me (just ignore the jakarta stuff).

franck102 commented 1 year ago

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.

zeppelinux commented 1 year ago

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. Everything you need is in this comment, notice the usage of alpha version (nothing else works) https://github.com/square/square-java-sdk/issues/100#issuecomment-1534045771

franck102 commented 1 year ago

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. Everything you need is in this comment, notice the usage of alpha version (nothing else works) #100 (comment)

Thanks @zeppelinux , I finally managed to make this work thanks in part to your suggestions. Regarding Quarkus one critical change was to override the versions brought in by the quarkus BOM:

<dependencyManagement>
        <dependencies>
            <?SORTPOM IGNORE?>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>logging-interceptor</artifactId>
                <version>5.0.0-alpha.11</version>
            </dependency>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp</artifactId>
                <version>5.0.0-alpha.11</version>
            </dependency>
            <dependency>
                <groupId>io.quarkus.platform</groupId>
                <artifactId>quarkus-bom</artifactId>
                <version>${quarkus.platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <?SORTPOM RESUME?>
zeppelinux commented 1 year ago

@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?

zenmasterjobo commented 1 year ago

šŸŽ‰ @zeppelinux Thank you very much for contributing your thoughts and guidance on this!!

zeppelinux commented 1 year ago

No worries @zenmasterjobo, it's all what Open Source is about, right? šŸ»

franck102 commented 1 year ago

@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?

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 mvn dependency:tree/list: Quarkus seems to have its own logic to resolve the dependencies.

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:

 <dependency>
      <groupId>com.sendinblue</groupId>
      <artifactId>sib-api-v3-sdk</artifactId>
      <exclusions>
        <exclusion>
          <groupId>com.squareup.okhttp</groupId>
          <artifactId>okhttp</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.squareup.okhttp</groupId>
          <artifactId>logging-interceptor</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.squareup.okio</groupId>
          <artifactId>okio</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

It may be that a comon okio version solves the issue, but I haven't had time to test that yet.

zeppelinux commented 1 year ago

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. Here is the pom.xml that works for me without any extra exclusions (I believe it's cleaner this way) https://github.com/zeppelinux/square-okhttp-problem/blob/main/pom.xml