selenium icon indicating copy to clipboard operation
selenium copied to clipboard

java.lang.NoClassDefFoundError: org/apache/http/auth/Credentials

Open ishwar6789 opened this issue 9 years ago • 2 comments

Version: Selenium 3.0.1 OS: Windows 10, Eclipse neon

Unable to initialize the chrome driver in the latest selenium 3.x same code works fine with 2.53.x, the stacktrace is copied below, seems like ApacheHttpClient reference is broken. anyideas?

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/auth/Credentials at org.openqa.selenium.remote.HttpCommandExecutor.getDefaultClientFactory(HttpCommandExecutor.java:92) at org.openqa.selenium.remote.HttpCommandExecutor.(HttpCommandExecutor.java:71) at org.openqa.selenium.remote.service.DriverCommandExecutor.(DriverCommandExecutor.java:62) at org.openqa.selenium.chrome.ChromeDriverCommandExecutor.(ChromeDriverCommandExecutor.java:40) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:174) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:163) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:120) at last.test.main(test.java:17) Caused by: java.lang.ClassNotFoundException: org.apache.http.auth.Credentials at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 8 more

ishwar6789 avatar Dec 23 '16 18:12 ishwar6789

Check your classpath, you should have httpclient 4.5.2 You likely need to update libs or if using maven check to see if another dependency is including a different version.

For further support I recommend asking on the google group - https://groups.google.com/forum/#!forum/selenium-users

lukeis avatar Jan 04 '17 20:01 lukeis

@ishwar6789 I 've had the same issue with mentioned versions of Selenium and Eclipse. It turned out some jars were corrupted (therefor NoClassDefFoundError). Fix: Close Eclipse. Go to C:\Users\MySelf.m2\repository and delete folders. Open Eclipse again and use Alt+F5 on project; check option Force Update of Snapshots. Hope it works for you too :)

monikandy avatar Jan 21 '17 16:01 monikandy