我得到下面的错误在我的sprint-boot-maven-java应用程序
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>
我尝试了下面的链接,其中有一些线索类似的问题,但每个链接都有自己的问题,并没有运气到目前为止.
- Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.SpringApplication
- 3.https://stackoverflow.com/questions/59884437/correct-the-classpath-of-your-application-so-that-it-contains-a-single-compatib
- Correct the classpath of your application so that it contains compatible versions of the classes Log4J2LoggingSystem and PropertiesUtil
- Correct the classpath of your application so that it contains a single, compatible version of org.apache.tomcat.util.compat.JreCompat. Using jsp file
- java- Correct the classpath of your application so that it contains compatible versions of the classes
- Correct the classpath of your application so that it contains compatible versions
- Correct classpath of your application so that it contains compatible versions of the classes BootstrapApplicationListener and SpringApplicationBuilder
1条答案
按热度按时间zyfwsgd61#
我能够解决这个问题。它与类路径有关。
1.退出IDE(IntelliJ)
1.在本地删除项目文件夹
1.删除.m2repository通过启用隐藏文件在我的mac((Shift+Cmd+.)
1.在不同位置文件夹上重新克隆项目
1.重新启动IDE并打开项目
1.构建项目并运行-它工作没有任何问题!