Selenium Webdriver Java - Eclipse java lang NoClassDefFoundError

+2 votes

I have installed java and eclipse, and downloaded the JARS and placed them in the right directory as it should be. Below is my script:

import org.openqa.selenium.WebDriver;

public class myClass {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

        System.setProperty("", "C:/Selenium/Drivers/chromedriver.exe");
        WebDriver driver = new ChromeDriver();

And i get the below error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/config/RegistryBuilder
    at org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(
    at org.openqa.selenium.remote.internal.HttpClientFactory.<init>(
    at org.openqa.selenium.remote.internal.HttpClientFactory.<init>(
    at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.getDefaultHttpClientFactory(
    at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.<init>(
    at org.openqa.selenium.remote.HttpCommandExecutor.getDefaultClientFactory(
    at org.openqa.selenium.remote.HttpCommandExecutor.<init>(
    at org.openqa.selenium.remote.service.DriverCommandExecutor.<init>(
    at myClass.main(
Caused by: java.lang.ClassNotFoundException: org.apache.http.config.RegistryBuilder
    at Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 13 more

This is my first script and i'm getting an error even though its basic. Can someone plz help?

Apr 14, 2018 in Selenium by kappa3010
• 2,090 points

I also found found the same issue. 

My code is :

package abcd;

import org.openqa.selenium.WebDriver;


public class Admin {

public static void main(String[] args) throws InterruptedException {

//Instantiate Chrome Browser Driver


//Create Chrome Browser Driver

WebDriver driver = new ChromeDriver();






And got below error 

Starting ChromeDriver 76.0.3809.68 (420c9498db8ce8fcd190a954d51297672c1515d5-refs/branch-heads/3809@{#864}) on port 27898

Only local connections are allowed.

Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 76

Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'

Driver info: driver.version: ChromeDriver

remote stacktrace: Backtrace:

Ordinal0 [0x009D7C93+1473683]

Ordinal0 [0x0095ADB1+961969]

Ordinal0 [0x008E42E3+475875]

Ordinal0 [0x0087F365+62309]

Ordinal0 [0x0087BC77+48247]

Ordinal0 [0x00899149+168265]

Ordinal0 [0x00898D1D+167197]

Ordinal0 [0x0089742B+160811]

Ordinal0 [0x00880AE6+68326]

Ordinal0 [0x00881BF0+72688]

Ordinal0 [0x00881B89+72585]

Ordinal0 [0x00974B77+1067895]

GetHandleVerifier [0x00A76875+506677]

GetHandleVerifier [0x00A76610+506064]

GetHandleVerifier [0x00A7D1B8+533624]

GetHandleVerifier [0x00A7704A+508682]

Ordinal0 [0x0096C266+1032806]

Ordinal0 [0x0096C0DF+1032415]

Ordinal0 [0x00976A8B+1075851]

Ordinal0 [0x00976BF3+1076211]

Ordinal0 [0x00975BA5+1072037]

BaseThreadInitThunk [0x74C433CA+18]

RtlInitializeExceptionChain [0x77449ED2+99]

RtlInitializeExceptionChain [0x77449EA5+54]

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(

at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(

at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(

at$3$1.accept(Unknown Source)

at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)

at Source)

at Source)

at Source)

at Source)

at$FindOp.evaluateSequential(Unknown Source)

at Source)

at Source)

at org.openqa.selenium.remote.ProtocolHandshake.createSession(

at org.openqa.selenium.remote.ProtocolHandshake.createSession(

at org.openqa.selenium.remote.HttpCommandExecutor.execute(

at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(

at org.openqa.selenium.remote.RemoteWebDriver.execute(

at org.openqa.selenium.remote.RemoteWebDriver.startSession(

at org.openqa.selenium.remote.RemoteWebDriver.<init>(




at abcd.Admin.main(

- I have added Jar files as well. and followed the steps which mentioned by king_kenny . But still facing the issue.

Please someone help me.

Hey there, you can first check which version of ChromeDriver is supported by Chrome Browser. You can simple google which version of ChromeDriver is supported by Chrome Browser version-76.

Then you can delete previously installed ChromeDriver.exe file and install the supported version.
Thank you so much. it is working. :)
Good to hear that. You can also post any other queries you have, here on Community.
Где Вы ищите свежие новости?
Лично я читаю и доверяю газете
Это единственный источник свежих и независимых новостей.
Рекомендую и Вам

3 answers to this question.

+5 votes
Best answer

I also faced this issue first time, in order to solve this I checked build path configured for my project.There you will see two options 1. Module path 2. Class path

Add your all external jars such as selenium jars under class path not module path and retry. It worked for me and If you need to know more, join our Selenium Training Online.

answered Aug 28, 2019 by Shraddha

selected Dec 9, 2019 by Kalgi
Hi Shraddha, thank you for sharing your solution.
It helped. Thankyou
You're welcome. You can also post your issues/queries on this community.
Thanks a bunch, It worked like charm for me too.

Thanks again
Glad it worked for you!!!
Thank u so much.It helped me alot
Thanks a ton.

I have been searching for this for a couple of hours!

Thanks a lot...i was struggling with this issue. it worked for me. Thanks again.

You're welcome nyan. You can post any other questions if you have on Selenium.
Thank you soooooooooooooooooooooo much. I was facing this issue from a long time and searched in so many websites. All are telling blah blah blah.Now I tried this and it worked for me.Thank you again.
Hey! Please do register at Edureka Community and upvote the answer if it has helped you :)
Thanks!This worked for me as well.:-)
Using given solution same problem has been fixed thanks...
This worked for me as well. I removed all the jars from the "Module Path" and added again to the "Class Path" and ran the first test of the launching Chrome successfully. Thanks- Shraddha
Thanks it worked
Thanks, @Kuntal for your contribution.

Please register at Edureka Community and earn credits for every contribution. A contribution could be asking a question, answering, commenting or even upvoting/downvoting an answer or question.

These credits can be used to get a discount on the course. Also, you could become the admin at Edureka Community with certain points.

Thank You so much !. The Same Issue Has Came To Me Also. You Answer Has Gave me a Solution To My Issue.

As you can see i dont have 1. Module path 2. Class path what can be done in my case as i am receiveing same error 

Error: Unable to initialize main class Demo
Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver

Have you added the Selenium Standalone JAR to your Java Project in Eclipse?
Thank you so much! I wasted 4 hours in solving this and you saved my day.
Glad to help! Do upvote the answer in case you found it helpful :)

 Where can I get the Module path and build path in the above said window.
You need to right-click on your project's name and go to "build path" in your eclipse IDE.
I am getting this below error even after adding required standalone and other jar files. Can you please help to solve this error.


[TestNG] Running:



java.lang.NoClassDefFoundError: javax/crypto/SecretKey












at java.util.jar.JarVerifier.processEntry(

at java.util.jar.JarVerifier.update(

at java.util.jar.JarFile.initializeVerifier(

at java.util.jar.JarFile.ensureInitialization(

at java.util.jar.JavaUtilJarAccessImpl.ensureInitialization(

at sun.misc.URLClassPath$JarLoader$2.getManifest(





at Method)


at java.lang.ClassLoader.loadClass(

at java.lang.ClassLoader.loadClass(

at sun.misc.Launcher$AppClassLoader.loadClass(

at java.lang.ClassLoader.loadClass(



at Method)

javax.crypto package is included in jce.jar, which can be found under the "lib" folder of your JRE. Add it to your classpath, and you should be fine.

For more information about classpath, see:

Thanks alot for help, it worked :D:D
Thanks a alot for help after trying for 2 hrs finaly i got it.
How to change that Brother can you tell the procedure plzzzz
0 votes

java.lang.NoClassDefFoundError is usually thrown when the installed JRE cannot find the Class which needs to be executed.

Also, the required imports and JARS would also not be available. It seems like you have tried to add the jars related to Java Client. So the only solution is to remove and place all the JARS again correctly.
Do th following:

  1. Remove all JARS including Selenium standalone server & Selenium Java client
  2. Import all the JARS which you downloaded from here:
  3. Make sure to import them to "Add External JARS" from "Conigure Build Path" option in Eclipse IDE.

This has to definately work.

answered Apr 14, 2018 by king_kenny
• 3,710 points
0 votes
can you the path like this way - C:\\Users\\Desktop\\SELENIUM\\chromedriver.exe
answered Feb 23, 2019 by anonymous
Yes, that's correct by the help of escaping character the error can be solved.

Related Questions In Selenium

0 votes
1 answer

Java.lang.CharSequence cannot be resolved error while using sendKeys() using Selenium Webdriver

You could try this, myElement .sendKeys(new String[] { ...READ MORE

answered Apr 4, 2018 in Selenium by Johnathon
• 9,090 points
+1 vote
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,500 points
+1 vote
3 answers

java.lang.ClassNotFoundException: okhttp3.ConnectionPool - Selenium Error

The only reason for ClassNotFoundException is if ...READ MORE

answered Mar 30, 2018 in Selenium by nsv999
• 5,500 points
+1 vote
1 answer

How to perform mouse hovering in Selenium WebDriver (Java)?

You many not actually be able to ...READ MORE

answered Apr 3, 2018 in Selenium by nsv999
• 5,500 points

edited Aug 22, 2023 by Khan Sarfaraz 10,494 views
0 votes
2 answers

How to scroll the Page up or down in Selenium WebDriver? (using java)

JavascriptExecutor jsx = (JavascriptExecutor)driver; jsx.executeScript("window.scrollBy(0,555)", ""); or Action classes ...READ MORE

answered Sep 6, 2020 in Selenium by Sri
• 3,190 points
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP