getting error in testng java lang NoClassDefFoundError com google common collect ImmutableMap

+1 vote
getting this error

java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap

here is the code:

package testngpkg;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import org.testng.annotations.Test;

public class firstclass {
 WebDriver driver;
 
  @Test
  public void browser() {
   driver = new ChromeDriver();
   driver.get("https://www.edureka.co/");
  
  }
}
Feb 14, 2020 in Selenium by Aarti
• 130 points
28,430 views
Do u have the Guava libraries imported in your classpath?

1 answer to this question.

0 votes

A NoClassDefFoundError is thrown when the JRE can't find a class. In your case, it can't find the class com.google.common.base.Function, which you most probably did not add to your classpath.

EDIT

After downloading the following libraries:

Selenium: http://code.google.com/p/selenium/downloads/list

Guava: http://code.google.com/p/guava-libraries/downloads/list

Apache HttpComponents: http://hc.apache.org/downloads.cgi

JSON jar: http://www.jarfinder.com/index.php/jars/versionInfo/21653

and unzipping them and putting all JAR files in a folder called lib, the test class:

Hope this helps!

Check out Selenium course to learn more about it!

answered Jun 4, 2020 by Ramesh
• 140 points
Hey @Ramesh thanks, buddy! but the JSON jar link isn't accessible.

Related Questions In Selenium

0 votes
1 answer
+1 vote
1 answer
0 votes
1 answer

Getting error while running a XML file in TestNG

Hello @Sradha, The synatx of using test is ...READ MORE

answered Dec 26, 2018 in Selenium by Rashmi
16,414 views
0 votes
0 answers
+1 vote
0 answers
0 votes
2 answers

TestNG error:- Cannot find class in classpath

The above link didn't work it means ...READ MORE

answered Feb 12, 2020 in Selenium by Rashmi Reddy PR
41,043 views
+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
18,699 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