appium/java-client

The old Selenium dependency makes user's code throw java.lang.NoSuchMethodError

TikhomirovSergey opened this issue · 11 comments

Description

There are many issue reports where users complain about java.lang.NoSuchMethodError and related dependency conflicts.

Environment

Any

Details

https://gist.github.com/TikhomirovSergey/f008a577cac9b6c92fb1def9a2aa5406

It seems I found the root cause. I is probably because of html-unit driver which is supplied by Selenium.
The possible solution:

  • exclude this artefact

@TikhomirovSergey can we exclude all the browser specific drivers?

@SrinivasanTarget I think only htmlUnit. Also could you check dependencies of phantomJS?

Can you please tell when you going to merge the fix, or if there is a workaround until the fix would be published. (Which version)
Thanks a lot guys!

@EitanBe We are going to merge it and publish 5.0.2 on this weekend (02.09.2017-03.09.2017). As a workaround you can add exclusions of htmlunit-driver and phantomjsDriver

@TikhomirovSergey I'm not able to reproduce this locally. I don't see any issues including html-unit driver. Everything works fine for me.

@EitanBe Can you share me your pom.xml or build.gradle inform of gist here?

@SrinivasanTarget It is difficult to reproduce it inside in sources. It may be reproduced when java_client is used as a dependency. Please take a look at this issue report #709. Please read the dependency tree attached to the report and take a look at dependencies.

Yeah @TikhomirovSergey I was trying to reproduce it as external dependency but still not able too.

@SrinivasanTarget Hi here is the list of my dependencies:


<dependencies>
        <!--Tests cucumber and spring junit-->
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java8</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>LATEST</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>LATEST</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-spring</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-apache</artifactId>
            <version>0.5.0</version>
        </dependency>
        <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-junit4</artifactId>
            <version>0.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>4.3.9.RELEASE</version>
        </dependency>
        <!-- End testing -->

        <!-- log4j -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>${log4j2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j2.version}</version>
        </dependency>

        <!-- End log4j -->

        <!-- jcraft for SSH-->
        <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.54</version>
        </dependency>

        <!-- End jcraft for SSH-->

        <!-- adb tool java object -->
        <dependency>
            <groupId>com.github.vidstige</groupId>
            <artifactId>jadb</artifactId>
            <version>1.0.1</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/jadb-1.0.0-SNAPSHOT.jar</systemPath>
        </dependency>

        <!-- End adb tool java object -->

        <!-- BigQuery -->
        <dependency>
            <groupId>com.google.apis</groupId>
            <artifactId>google-api-services-bigquery</artifactId>
            <version>v2-rev355-1.22.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.oauth-client</groupId>
            <artifactId>google-oauth-client</artifactId>
            <version>1.21.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.http-client</groupId>
            <artifactId>google-http-client-jackson2</artifactId>
            <version>1.21.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.oauth-client</groupId>
            <artifactId>google-oauth-client-jetty</artifactId>
            <version>1.21.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.7</version>
        </dependency>
        <dependency>
            <groupId>com.google.truth</groupId>
            <artifactId>truth</artifactId>
            <version>0.29</version>
        </dependency>

        <!-- End BigQuery -->


        <!-- ok http -->
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>3.8.1</version>
        </dependency>

        <dependency>
            <groupId>com.mashape.unirest</groupId>
            <artifactId>unirest-java</artifactId>
            <version>1.4.9</version>
        </dependency>
        <!-- End ok http -->

        <!-- CSV -->

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>1.1</version>
        </dependency>

        <!-- End CSV -->

        <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160810</version>
        </dependency>

        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>5.0.1</version>
        </dependency>

Hi guys,
I added manually:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-remote-driver</artifactId>
    <version>3.5.3</version>
</dependency>

and it works now...