[🐛 Bug]: Exception in thread "main" java.lang.NoClassDefFoundError: dev/failsafe/Policy
What happened?
I am using Eclipse -> Maven with Selenium version 4.25.0 . I have almost tried every solution present on github , youtube and chatgpt still not able to resolve the issue .
i have tried to run my code even after adding dev.failsafe dependency ->
<dependency>
<groupId>dev.failsafe</groupId>
<artifactId>failsafe</artifactId>
<version>3.3.0</version>
</dependency>
still facing the same issue.
here is my pom file -> pom file .docx
How can we reproduce the issue?
{ public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "\"/Users/tusharyadav/Documents/chromedriver\"");
var driver = new ChromeDriver();
driver.get("https://www.google.com");
}
}
Relevant log output
Exception in thread "main" 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)
at introduction/introduction.Chrome.main(Chrome.java:10)
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:526)
... 4 more
Operating System
macOS Sonoma 14.0
Selenium version
Maven 4.0.0 , selenium-java 4.25.0
What are the browser(s) and version(s) where you see this issue?
Chrome Version 129.0.6668.90 (Official Build) (arm64)
What are the browser driver(s) and version(s) where you see this issue?
chrome driver -129.0.6668.89
Are you using Selenium Grid?
no
@36Tushar, 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!
@36Tushar you should remove the duplicate selenium-java and testng entries from your pom.xml. Alter this run mvn dependency:tree to check all selenium jars are from the same release version.
I have removed and checked versions and all selenium jars are from same release versions .
@36Tushar could you share the output of mvn dependency:tree as txt file?
I am also facing this same issue. Is there a solution for this?
I don't have a solution, but a workaround for now.
This seems to be related to the java module system.
Adding requires dev.failsafe.core; to my module declaration did help.
Thanks will try it and let you know.
@36Tushar did this workaround work for you?
I am closing because the OP did not reply.
This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.