selenium: [🐛 Bug]: Selenium-Java 4.16.1 cannot start in Spring Boot
What happened?
I got the error when I started the project with Selenium-Java 4.16.1
Starting ChromeDriver 119.0.6045.105 (38c72552c5e15ba9b3117c0967a0fd105072d7c6-refs/branch-heads/6045@{#1103}) on port 64173 All remote connections are allowed. Use an allowlist instead! Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully. [1702042241.365][WARNING]: This version of ChromeDriver has not been tested with Chrome version 120. 2023-12-08 16:30:41.542 INFO 53239 — [ null to remote] o.o.selenium.remote.ProtocolHandshake : Detected dialect: W3C 2023-12-08 16:30:41.602 INFO 53239 — [ main] o.o.selenium.devtools.CdpVersionFinder : Found exact CDP implementation for version 120 2023-12-08 16:30:41.612 WARN 53239 — [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘amazonCrawlerProviderApplication’: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: ‘java.util.function.Function org.openqa.selenium.devtools.ConverterFunctions.map(java.lang.String, java.util.function.Function)’ 2023-12-08 16:30:41.614 INFO 53239 — [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit ‘default’ 2023-12-08 16:30:41.617 INFO 53239 — [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated… 2023-12-08 16:30:41.622 INFO 53239 — [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. 2023-12-08 16:30:41.623 INFO 53239 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2023-12-08 16:30:41.636 INFO 53239 — [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled. 2023-12-08 16:30:41.659 ERROR 53239 — [ main] o.s.b.d.LoggingFailureAnalysisReporter :
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:
org.openqa.selenium.devtools.v120.target.Target.getTargets(Target.java:153)
The following method did not exist:
'java.util.function.Function org.openqa.selenium.devtools.ConverterFunctions.map(java.lang.String, java.util.function.Function)'
The calling method’s class, org.openqa.selenium.devtools.v120.target.Target, was loaded from the following location:
jar:file:/~/.m2/repository/org/seleniumhq/selenium/selenium-devtools-v120/4.16.0/selenium-devtools-v120-4.16.0.jar!/org/openqa/selenium/devtools/v120/target/Target.class
The called method’s class, org.openqa.selenium.devtools.ConverterFunctions, is available from the following locations:
jar:file:/~/.m2/repository/org/seleniumhq/selenium/selenium-remote-driver/4.1.4/selenium-remote-driver-4.1.4.jar!/org/openqa/selenium/devtools/ConverterFunctions.class
The called method’s class hierarchy was loaded from the following locations:
org.openqa.selenium.devtools.ConverterFunctions: file:/~/.m2/repository/org/seleniumhq/selenium/selenium-remote-driver/4.1.4/selenium-remote-driver-4.1.4.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.openqa.selenium.devtools.v120.target.Target and org.openqa.selenium.devtools.ConverterFunctions
Disconnected from the target VM, address: ‘127.0.0.1:64413’, transport: ‘socket’
Process finished with exit code 1
How can we reproduce the issue?
Use the dependency on Java 11 and Spring Boot 2.7.10
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.16.1</version>
</dependency>
Relevant log output
The log is defined above
Operating System
MacOS Ventura 13.6.1
Selenium version
Java 4.16.1
What are the browser(s) and version(s) where you see this issue?
Chrome 119
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 119.0.6045.105
Are you using Selenium Grid?
No
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (6 by maintainers)
springboot version,<selenium.version>4.16.1</selenium.version>
This was written by one of our contributors: https://www.javaadvent.com/2020/12/how-to-debug-dependency-conflicts-in-maven-and-gradle.html