0
votes

Im having an App engine project that having an Api class to be deployed in Google app engine, when I execute these lines to create a JSON file for open API it gives me the following build error:

mvn clean package
mvn endpoints-framework:openApiDocs

[ERROR] Failed to execute goal com.google.cloud.tools:endpoints-framework-maven-plugin:1.0.2:openApiDocs (default-cli) on project Harmonica-API: Execution default-cli of goal com.google.cloud.tools:endpoints-framework-maven-plugin:1.0.2:openApiDocs failed: An API incompatibility was encountered while executing com.google.cloud.tools:endpoints-framework-maven-plugin:1.0.2:openApiDocs: java.lang.NoSuchMethodError: com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient$Builder.setBatchPath(Ljava/lang/String;)Lcom/google/api/client/googleapis/services/AbstractGoogleClient$Builder;

find below is my dependencies in the POM.xml file

    <dependency>
        <groupId>com.google.endpoints</groupId>
        <artifactId>endpoints-framework</artifactId>
        <version>2.2.1</version>
    </dependency>


    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <type>jar</type>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>


    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.10</version>
    </dependency>

    <dependency>
        <groupId>Harmonica-DAOs</groupId>
        <artifactId>Harmonica-DAOs</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>com.sendgrid</groupId>
        <artifactId>sendgrid-java</artifactId>
        <version>4.1.0</version>
    </dependency>

    <dependency>
        <groupId>net.htmlparser.jericho</groupId>
        <artifactId>jericho-html</artifactId>
        <version>3.4</version>
    </dependency>

    <dependency>
      <groupId>com.google.endpoints</groupId>
      <artifactId>endpoints-management-control-appengine-all</artifactId>
      <version>1.0.11</version>
    </dependency>

and find below is the POM of the DAO project:

    <dependency>
        <groupId>com.restfb</groupId>
        <artifactId>restfb</artifactId>
        <version>2.12.0</version>
    </dependency>

    <dependency>
        <groupId>com.nimbusds</groupId>
        <artifactId>nimbus-jose-jwt</artifactId>
        <version>4.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.0</version>
    </dependency>

    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-1.0-sdk</artifactId>
        <version>${appengine.target.version}</version>
    </dependency>

    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>org.eclipse.persistence.jpa</artifactId>
        <version>2.7.0</version>
        <!-- <exclusions> -->
        <!-- <exclusion> -->
        <!-- <groupId>org.eclipse.persistence</groupId> -->
        <!-- <artifactId>javax.persistence</artifactId> -->
        <!-- </exclusion> -->
        <!-- </exclusions> -->

    </dependency>

    <dependency>
        <groupId>javax.json</groupId>
        <artifactId>javax.json-api</artifactId>
        <version>1.0</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.0</version>
    </dependency>

    <dependency>
        <groupId>net.minidev</groupId>
        <artifactId>json-smart</artifactId>
        <version>1.0.6.3</version>
    </dependency>

    <dependency>
        <groupId>com.google.firebase</groupId>
        <artifactId>firebase-admin</artifactId>
        <version>5.8.0</version>
        <exclusions>
            <exclusion>
                <groupId>com.google.http-client</groupId>
                <artifactId>google-http-client-gson</artifactId>
            </exclusion>

            <exclusion>
                <groupId>com.google.api-client</groupId>
                <artifactId>google-api-client</artifactId>
            </exclusion>

            <exclusion>
                <groupId>com.google.api-client</groupId>
                <artifactId>google-api-client-gson</artifactId>
            </exclusion>


            <exclusion>
                <groupId>com.google.http-client</groupId>
                <artifactId>google-http-client</artifactId>
            </exclusion>

            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>

            <exclusion>
                <groupId>io.netty</groupId>
                <artifactId>netty-codec-http</artifactId>
            </exclusion>


            <exclusion>
                <groupId>io.netty</groupId>
                <artifactId>netty-handler</artifactId>
            </exclusion>


            <exclusion>
                <groupId>io.netty</groupId>
                <artifactId>netty-transport</artifactId>
            </exclusion>

            <exclusion>
                <groupId>com.google.cloud</groupId>
                <artifactId>google-cloud-storage</artifactId>
            </exclusion>

            <!-- <exclusion> -->
            <!-- <groupId>io.grpc</groupId> -->
            <!-- <artifactId>grpc-core</artifactId> -->
            <!-- </exclusion> -->

        </exclusions>

    </dependency>


    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.8.2</version>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.12</version>
        <exclusions>
            <exclusion>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java</artifactId>
            </exclusion>
        </exclusions>

    </dependency>

    <dependency>
        <groupId>com.google.cloud.sql</groupId>
        <artifactId>mysql-socket-factory-connector-j-8</artifactId>
        <version>1.0.11</version>
    </dependency>

    <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-storage</artifactId>
        <version>1.77.0</version>
    </dependency>


    <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-bigquery</artifactId>
        <version>0.34.0-beta</version>
        <!-- <exclusions> -->
        <!-- <exclusion> -->
        <!-- <groupId>com.google.api</groupId> -->
        <!-- <artifactId>gax</artifactId> -->
        <!-- </exclusion> -->
        <!-- </exclusions> -->


    </dependency>

    <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-logging</artifactId>
        <version>1.16.0</version>

        <exclusions>

            <exclusion>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-core</artifactId>
            </exclusion>
        </exclusions>

    </dependency>


    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-nop</artifactId>
        <version>1.7.25</version>
    </dependency>


    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.10</version>
    </dependency>


    <dependency>
        <groupId>org.owasp.encoder</groupId>
        <artifactId>encoder</artifactId>
        <version>1.2.2</version>
    </dependency>

    <dependency>
        <groupId>org.twitter4j</groupId>
        <artifactId>twitter4j-core</artifactId>
        <version>4.0.6</version>
    </dependency>

    <dependency>
        <groupId>com.opencsv</groupId>
        <artifactId>opencsv</artifactId>
        <version>3.3</version>
    </dependency>

    <dependency>
        <groupId>org.mindrot</groupId>
        <artifactId>jbcrypt</artifactId>
        <version>0.4</version>
    </dependency>

    <dependency>
        <groupId>com.sendgrid</groupId>
        <artifactId>sendgrid-java</artifactId>
        <version>4.1.0</version>
    </dependency>

    <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-datastore</artifactId>
        <version>1.34.0</version>
        <exclusions>

            <exclusion>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-core</artifactId>
            </exclusion>
        </exclusions>

    </dependency>

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-sns</artifactId>
        <version>1.11.235</version>
    </dependency>

    <dependency>
        <groupId>com.stripe</groupId>
        <artifactId>stripe-java</artifactId>
        <version>7.24.0</version>
    </dependency>


    <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-kms</artifactId>
        <version>1.0.0</version>
        <exclusions>

            <exclusion>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-core</artifactId>
            </exclusion>
        </exclusions>

    </dependency>

    <dependency>
        <groupId>com.segment.analytics.java</groupId>
        <artifactId>analytics</artifactId>
        <version>2.1.1</version>
    </dependency>

    <dependency>
        <groupId>com.google.api</groupId>
        <artifactId>gax-grpc</artifactId>
        <version>1.42.0</version>
    </dependency>

    <dependency>
        <groupId>net.imagej</groupId>
        <artifactId>ij</artifactId>
        <version>1.52p</version>
    </dependency>

    <dependency>
        <groupId>com.twilio.sdk</groupId>
        <artifactId>twilio</artifactId>
        <version>7.42.0</version>
    </dependency>

Can any one help me plz? given that The project is built and deployed successfully in App engine

1

1 Answers

1
votes

The error message you got usually means that either you have dependencies missing, mis-configured or their versions are out of date [1]. In your case, you are missing the “endpoints-framework-maven-plugin” in your pom.xml file. Add the plugin as follows [2].

 <plugin>
   <groupId>com.google.cloud.tools</groupId>
   <artifactId>endpoints-framework-maven-plugin</artifactId>
   <version>1.0.2</version>
   <configuration>
     <!-- plugin configuration -->
     <hostname>${endpoints.project.id}.appspot.com</hostname>
   </configuration>
 </plugin>

[1] https://github.com/GoogleCloudPlatform/getting-started-java/issues/325#issuecomment-554639034 [2] https://cloud.google.com/endpoints/docs/frameworks/java/maven-endpoints-frameworks-plugin