NoClassDef Found Exception occured

0 votes
Exception in thread "main" java.lang.NoClassDefFoundError: okhttp3/ConnectionPool

at org.openqa.selenium.remote.internal.OkHttpClient$Factory.<init>(OkHttpClient.java:116)

at org.openqa.selenium.remote.http.HttpClient$Factory.createDefault(HttpClient.java:66)

at org.openqa.selenium.remote.HttpCommandExecutor.<clinit>(HttpCommandExecutor.java:47)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)

at Pack.FaceBookTest.main(FaceBookTest.java:13)

Caused by: java.lang.ClassNotFoundException: okhttp3.ConnectionPool

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)

... 7 more
Oct 30, 2020 in Selenium by Boopathy
• 370 points
1,575 views

1 answer to this question.

0 votes

Here are a few probable steps to solve the NoClassDefFoundError - okhttp3/ConnectionPool error :

  • While using a Build Tool e.g. Maven or Gradleremove all the External JARs from the Java Build PathMaven or Gradle will download and resolve all the required dependencies.
  • If using Selenium JARs within a Java Project add only required External JARs within the Java Build Path and remove the unused one.
  • While using Maven, either use <artifactId>selenium-java</artifactId> or <artifactId>selenium-server</artifactId>. Avoid using both at the same time.
  • Upgrade JDK to recent levels JDK 8u162.
  • Upgrade Selenium to current levels Version 3.10.0.
  • Upgrade ChromeDriver ChromeDriver v2.37 level.
  • Keep Chrome version at Chrome v64-66 levels. (as per ChromeDriver v2.37 release notes)
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite.

 Hope this helps!

answered Oct 30, 2020 by Sandra

Related Questions In Selenium

0 votes
1 answer

Which exception is raised when an element is not found in an HTML DOM using XPath

Hey, A stale element reference exception is thrown in one of two cases If ...READ MORE

answered Jul 30, 2020 in Selenium by Sirajul
• 59,230 points
10,631 views
0 votes
1 answer

Xpath element not found

You need to induce WebDriverWait with expected_conditions ...READ MORE

answered Mar 27, 2018 in Selenium by ned_crew
• 1,610 points
3,406 views
–1 vote
1 answer

Selenium XPath error:- Element not found

The reason for Element not found exception ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,500 points
20,498 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Page Factory: StaleElementReference Exception

Usually, a StaleElementReferenceException is thrown when: 1. ...READ MORE

answered Apr 21, 2018 in Selenium by king_kenny
• 3,710 points
1,456 views
0 votes
1 answer

Selenium Exception: Element is not visible

Finding the element before locating the one ...READ MORE

answered May 7, 2018 in Selenium by king_kenny
• 3,710 points
7,241 views
0 votes
1 answer

NoSuchElementException exception with headless chrome and selenium

As you are seeing NoSuchElementException you can consider using ...READ MORE

answered May 7, 2018 in Selenium by Samarpit
• 5,910 points
8,273 views
+1 vote
1 answer

Throwing Hamcrest exception message while actual and expected are same

Below will help you: Its due to string ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,910 points
797 views
0 votes
6 answers

How to get text found between span – selenium

The text "Search Zone" is not part ...READ MORE

answered Feb 28, 2019 in Selenium by Trying to Figure
76,232 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP