0

I am getting below error in my sprint-boot-maven-java application

APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    io.appium.java_client.remote.AppiumNewSessionCommandPayload.makeW3CSafe(AppiumNewSessionCommandPayload.java:40)

The following method did not exist:

    'java.util.stream.Collector com.google.common.collect.ImmutableMap.toImmutableMap(java.util.function.Function, java.util.function.Function)'

The calling method's class, io.appium.java_client.remote.AppiumNewSessionCommandPayload, was loaded from the following location:

    jar:file:/Users/sainiranjangajula/.m2/repository/io/appium/java-client/8.3.0/java-client-8.3.0.jar!/io/appium/java_client/remote/AppiumNewSessionCommandPayload.class

The called method's class, com.google.common.collect.ImmutableMap, is available from the following locations:

    jar:file:/Users/sainiranjangajula/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar!/com/google/common/collect/ImmutableMap.class
    jar:file:/Users/sainiranjangajula/.m2/repository/com/google/guava/guava/30.1.1-jre/guava-30.1.1-jre.jar!/com/google/common/collect/ImmutableMap.class

The called method's class hierarchy was loaded from the following locations:

    com.google.common.collect.ImmutableMap: file:/Users/sainiranjangajula/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes io.appium.java_client.remote.AppiumNewSessionCommandPayload and com.google.common.collect.ImmutableMap

2023-08-21 13:57:03.728  WARN 18548 --- [           main] c.z.a.core.registrar.TestRunRegistrar    : Reporting disabled: using no op test run registrar

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>com.telus.connect</groupId>
    <artifactId>automatiom</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>App Name</name>
    <properties>
        <!--<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>-->
        <java.version>11</java.version>
        <selenium.version>4.8.1</selenium.version>
        <appium.version>8.3.0</appium.version>
        <testng.version>7.7.1</testng.version>
        <cucumber.version>7.11.1</cucumber.version>
        <androidDefaultSuiteFiles>internetTestSuite/android-regression-test-suite.xml</androidDefaultSuiteFiles>
        <androidSuiteFile>${androidDefaultSuiteFiles}</androidSuiteFile>
        <iosDefaultSuiteFiles>internetTestSuite/ios-regression-test-suite.xml</iosDefaultSuiteFiles>
        <iosSuiteFile>${iosDefaultSuiteFiles}</iosSuiteFile>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.appium/java-client -->
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>${appium.version}</version>
        </dependency>

        <!-- Spring-boot related dependencies -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <!-- Spring-boot related dependencies -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>2.0.6</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.24</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.24.2</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
        </dependency>

        <!---Cucumber lib-->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cucumber.version}</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-spring</artifactId>
            <version>${cucumber.version}</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>${cucumber.version}</version>
        </dependency>
        <!--Cucumber lib-->

        <dependency>
            <groupId>com.typesafe</groupId>
            <artifactId>config</artifactId>
            <version>1.4.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.12.0</version>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>2.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>5.0.0-alpha.11</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.12.7.1</version> <!-- Use the latest version available -->
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-report-plugin -->
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>3.0.0</version>
        </dependency>

        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-cucumber7-jvm</artifactId>
            <version>2.22.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.cucumber/gherkin -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>gherkin</artifactId>
            <version>26.2.0</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>7.11.1</version> <!-- Check for the latest version -->
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>7.11.1</version>
        </dependency>
        <dependency>
            <groupId>net.masterthought</groupId>
            <artifactId>cucumber-reporting</artifactId>
            <version>5.6.0</version> <!-- Check for the latest version -->
        </dependency>
        <dependency>
            <groupId>com.zebrunner</groupId>
            <artifactId>agent-testng</artifactId>
            <version>1.9.6</version>
        </dependency>

    </dependencies>


    <profiles>
        <!--IOS Remote Profile-->
        <profile>
            <id>iosRemote</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.10.1</version>
                        <configuration>
                            <source>11</source>
                            <target>11</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.22.2</version>
                        <configuration>
                            <suiteXmlFiles>
                                <!--suppress UnresolvedMavenProperty -->
                                <suiteXmlFile>${iosSuiteFile}</suiteXmlFile>
                            </suiteXmlFiles>
                            <systemPropertyVariables>
                                <driver>ios</driver>
                                <spring.profiles.active>remote</spring.profiles.active>
                            </systemPropertyVariables>
                            <reportsDirectory>Reports/IOSReports</reportsDirectory>
                            <testFailureIgnore>true</testFailureIgnore>
                            <disableXmlReport>true</disableXmlReport>
                            <properties>
                                <property>
                                    <name>surefire.testng.verbose</name>
                                    <value>10</value>
                                </property>
                            </properties>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!--Android Remote Profile-->
        <profile>
            <id>androidRemote</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.10.1</version>
                        <configuration>
                            <source>11</source>
                            <target>11</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.22.2</version>
                        <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>${androidSuiteFile}</suiteXmlFile>
                            </suiteXmlFiles>
                            <systemPropertyVariables>
                                <driver>android</driver>
                                <spring.profiles.active>remote</spring.profiles.active>
                            </systemPropertyVariables>
                            <reportsDirectory>Reports/AndroidReports</reportsDirectory>
                            <testFailureIgnore>true</testFailureIgnore>
<!--                            <disableXmlReport>true</disableXmlReport>-->
                            <properties>
                                <property>
                                    <name>surefire.testng.verbose</name>
                                    <value>10</value>
                                </property>
                            </properties>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!--Local Profile-->
        <profile>
            <id>local</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.10.1</version>
                        <configuration>
                            <source>11</source>
                            <target>11</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.22.2</version>
                        <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>feature-test-suite.xml</suiteXmlFile>
                            </suiteXmlFiles>
                            <systemPropertyVariables>
                                <driver>android</driver>
                                <spring.profiles.active>local</spring.profiles.active>
                            </systemPropertyVariables>
                            <reportsDirectory>Reports/AndroidReports</reportsDirectory>
                            <testFailureIgnore>true</testFailureIgnore>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

I tried below links which had similar issue for some lead but each link has its own issue and had no luck so far.

  1. Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.SpringApplication
  2. Correct classpath of your application so it contains compatible versions of classes org.springframework.boot.autoconfigure.http.HttpMessageConverter 3.https://stackoverflow.com/questions/59884437/correct-the-classpath-of-your-application-so-that-it-contains-a-single-compatib
  3. Correct the classpath of your application so that it contains compatible versions of the classes Log4J2LoggingSystem and PropertiesUtil
  4. Correct the classpath of your application so that it contains a single, compatible version of org.apache.tomcat.util.compat.JreCompat. Using jsp file
  5. java- Correct the classpath of your application so that it contains compatible versions of the classes
  6. Correct the classpath of your application so that it contains compatible versions
  7. Correct classpath of your application so that it contains compatible versions of the classes BootstrapApplicationListener and SpringApplicationBuilder
GSN
  • 123
  • 2
  • 13
  • It's impossible to answer your question because your problem is to big. Try following https://stackoverflow.com/help/minimal-reproducible-example. You may also have some luck inspectingyour dependency tree with `mvn dependency:tree -Dverbose`. You can probably spot the problem mentioned in the message there. But it will not be easy because your project is large. – M.P. Korstanje Aug 22 '23 at 09:06
  • @M.P.Korstanje I feel nothing is impossible. With couple of tries I was able to fix this issue. I've posted below. :) – GSN Aug 25 '23 at 17:05
  • I don't see a causal link between what you did to make the problem go away and the problem you described in your post. https://en.m.wikipedia.org/wiki/Cargo_cult – M.P. Korstanje Aug 25 '23 at 23:24

1 Answers1

0

I was able to fix this issue. It was to do with classpath.

  1. Quit IDE (IntelliJ)
  2. Delete project folder in local
  3. Delete .m2repository by enabling hidden files on my mac ((Shift+Cmd+.)
  4. Re-clone project on different location folder
  5. Re-launch IDE and open the project
  6. Build the project and run - It worked without any issues!
GSN
  • 123
  • 2
  • 13