selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🐛 Bug]: Exception in thread "main" java.lang.NoClassDefFoundError: dev/failsafe/Policy

Open 36Tushar opened this issue 1 year ago • 5 comments

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 avatar Oct 06 '24 05:10 36Tushar

@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!

github-actions[bot] avatar Oct 06 '24 05:10 github-actions[bot]

@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.

joerg1985 avatar Oct 07 '24 22:10 joerg1985

I have removed and checked versions and all selenium jars are from same release versions .

pom 2.docx

36Tushar avatar Oct 08 '24 15:10 36Tushar

@36Tushar could you share the output of mvn dependency:tree as txt file?

joerg1985 avatar Oct 08 '24 17:10 joerg1985

pom file.txt

Here is my pom file

output.txt

Here is my output

36Tushar avatar Oct 15 '24 02:10 36Tushar

I am also facing this same issue. Is there a solution for this?

ahinvinith avatar Nov 14 '24 06:11 ahinvinith

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.

joerg1985 avatar Nov 14 '24 12:11 joerg1985

Thanks will try it and let you know.

36Tushar avatar Nov 15 '24 04:11 36Tushar

@36Tushar did this workaround work for you?

joerg1985 avatar Nov 26 '24 21:11 joerg1985

I am closing because the OP did not reply.

diemol avatar Dec 23 '24 22:12 diemol

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.

github-actions[bot] avatar Jan 22 '25 22:01 github-actions[bot]