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 13, 2018 in Selenium by kappa3010
• 2,080 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.
answered Aug 28, 2019 by Shraddha

selected Dec 9, 2019 by Kalgi
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 :)
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 13, 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
0 votes
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,510 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,510 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,510 points

edited Apr 4, 2018 by nsv999 4,460 views
0 votes
1 answer
0 votes
1 answer

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

Its pretty simple. Check out the below ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,510 points
0 votes
1 answer

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,510 points
0 votes
1 answer
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,870 points
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,870 points