Selenium Webdriver + Java - Eclipse: java.lang.NoClassDefFoundError

0 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,020 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.

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,650 points
0 votes
can you the path like this way - C:\\Users\\Desktop\\SELENIUM\\chromedriver.exe
answered Feb 23 by anonymous
Yes, that's correct by the help of escaping character the error can be solved.
+2 votes
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 by Shraddha
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.

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,080 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,110 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,110 points
0 votes
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,110 points

edited Apr 4, 2018 by nsv999 3,302 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,110 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,110 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,130 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,130 points