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
Feb 29 in Selenium by Sudharsan
• 120 points
504 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 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
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 in Selenium by anonymous
225 views
0 votes
1 answer

How to resolve Pycharm Referenced Error with Import Selenium Web driver?

Below will help: Pycharm > Preferences > Project ...READ MORE

answered Jun 26, 2018 in Selenium by Samarpit
• 5,890 points
3,857 views
0 votes
0 answers

Could you please help me with some selenium projects along with source code?

I am learning selenium and  I have ...READ MORE

Mar 10, 2019 in Selenium by Mark
132 views