[π Bug]: java.lang.NoClassDefFoundError: dev/failsafe/Policy
mammadyahyayev opened this issue Β· comments
What happened?
I am using Maven with Selenium version 4.18.1
. I tried almost every old version (from 4.11.0
to 4.18.1
) of Selenium still got the same issue in every version.
I've see this error happened on others who use Java FX, but I don't use Java FX.
I tried to add failsafe dependency
<dependency>
<groupId>dev.failsafe</groupId>
<artifactId>failsafe</artifactId>
<version>3.3.2</version>
</dependency>
still got the same error.
Note
I am using Java 17 with modules (module-info.java).
module module.name {
requires org.seleniumhq.selenium.api;
requires org.apache.logging.log4j;
requires org.seleniumhq.selenium.remote_driver;
requires org.seleniumhq.selenium.chrome_driver;
}
How can we reproduce the issue?
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Admin\\Downloads\\chrome_win64\\chrome.exe");
var driver = new ChromeDriver();
driver.get("https://www.google.com");
In above code, I tried other Chrome versions, but still got the same error (`java.lang.NoClassDefFoundError: dev/failsafe/Policy`).
Relevant log output
java.lang.NoClassDefFoundError: dev/failsafe/Policy
at org.seleniumhq.selenium.http/org.openqa.selenium.remote.http.ClientConfig.<clinit>(ClientConfig.java:33)
at org.seleniumhq.selenium.chrome_driver/org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:84)
at org.seleniumhq.selenium.chrome_driver/org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:52)
Caused by: java.lang.ClassNotFoundException: dev.failsafe.Policy
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 9 more
Operating System
Windows 10
Selenium version
4.18.1 (maven -> org.seleniumhq.selenium:selenium-java:4.18.1
)
What are the browser(s) and version(s) where you see this issue?
Chrome 114.0.5735.90, 122.0.6261.111 (r1250580)
What are the browser driver(s) and version(s) where you see this issue?
Chrome 114.0.5735.90, 122.0.6261.111 (r1250580)
Are you using Selenium Grid?
No
@mammadyahyayev, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template
label.
If the issue is a question, add the I-question
label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted
label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable G-*
label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer
label.
Thank you!
Your module file should have looked like below:
module issue_13670 {
requires org.seleniumhq.selenium.api;
requires org.seleniumhq.selenium.remote_driver;
requires org.seleniumhq.selenium.chrome_driver;
requires org.testng;
exports com.rationaleemotions;
requires dev.failsafe.core;
}
The important line is requires dev.failsafe.core;
Here's a complete project that shows all of this in action.
@mammadyahyayev - Feel free to close this issue once you have confirmed that the above solution works.
@krmahadevan thanks a lot, it worked, I thought I've already tried this one, but I missed.