Getting error NoClassDeffound error while exceuting selenium script created with maven please help me to resolve this

0 votes
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap

at org.openqa.selenium.remote.service.DriverService$Builder.<init>(DriverService.java:259)

at org.openqa.selenium.chrome.ChromeDriverService$Builder.<init>(ChromeDriverService.java:101)

at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)

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

at selenium.SeleniumBasics.main(SeleniumBasics.java:12)

Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap

at java.net.URLClassLoader$1.run(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

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)

... 5 more
Mar 1, 2020 in Selenium by Sudharsan
• 120 points
6,241 views
Do u have the Guava libraries imported in your classpath? Ensure you have added all the dependency jar files.
Yes, i have imported Guava jar files also, I can able to see Guava jar file under maven dependencies
Hey @Sudarshan, could you please specify the version details of the tools you are using? Maybe there's a version mismatch of version in any of your jar files. Just have a look, just in case!

1 answer to this question.

0 votes
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap

at org.openqa.selenium.remote.service.DriverService$Builder.<init>(DriverService.java:259)

at org.openqa.selenium.chrome.ChromeDriverService$Builder.<init>(ChromeDriverService.java:101)

at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)

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

at newpackage.New.main(New.java:10)

Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap

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)

... 5 more
answered Apr 20, 2020 by celine
Hey @Celine, Have you checked the build path configured for your project. There you will see two options 1. Module path 2. Classpath.

Add your all external jars such as selenium jars under classpath not module path and retry. It worked for me.

Also, make sure you have guava libraries imported.

Related Questions In Selenium

0 votes
1 answer

Please help me with automation script for testing Carousel Rotation with Selenium Webdriver.

Hey Hussain, you can use following lines ...READ MORE

answered Aug 14, 2019 in Selenium by Abha
• 28,140 points

edited Jul 19, 2023 by Khan Sarfaraz 4,944 views
0 votes
1 answer
0 votes
1 answer

Getting error while run the selenium scripts.How can i resolve this issue?

Tq. Yes, it worked for me. READ MORE

answered Jun 16, 2020 in Selenium by anonymous
2,962 views
0 votes
1 answer

I am not able to generate extent report with screenshot in selenium cucumber java .. Please help me out

Hello @kanikahans, You need to define Extent Report ...READ MORE

answered Aug 24, 2020 in Selenium by Niroj
• 82,840 points
8,470 views
0 votes
1 answer
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