Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function at Goto.

24,996 views
Skip to first unread message

hari nath

unread,
Dec 20, 2013, 1:27:15 AM12/20/13
to seleniu...@googlegroups.com
HI ALL,

When i execute my login code it showing the below error.plz help me 
my code is...

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class login {
public static void main(String[] args) throws Exception {
            WebDriver driver = new FirefoxDriver();
            driver.get("https://www.google.co.in");
}
}

Exception is:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function
at Goto.login.main(login.java:9)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 1 more

Avikash Gorka

unread,
Dec 20, 2013, 1:43:03 AM12/20/13
to Selenium Users

On 20 December 2013 11:57, hari nath <hari.sa...@gmail.com> wrote:
it showing the below error.plz help me 
my code is...

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class login {
public static void main(String[] args) throws Exception {
            WebDriver driver = new FirefoxDriver();
            driver.get("https://www.google.co.in");
}
}

Exception is:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function

Check your classpath

Thanks & Regards,
Avikash Gorka


hari nath

unread,
Dec 20, 2013, 2:16:29 AM12/20/13
to seleniu...@googlegroups.com
Every thing is correct................

Krishnan Mahadevan

unread,
Dec 20, 2013, 2:19:38 AM12/20/13
to Selenium Users
You are having a clear cut problem of missing jars in your class path.

How have you added up the selenium jars in your classpath ? Is this a maven project ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/afdb2420-2fd9-408b-aadd-d8e83d0df8f2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

hari nath

unread,
Dec 20, 2013, 2:24:20 AM12/20/13
to seleniu...@googlegroups.com
i just added throw external jars.



For more options, visit https://groups.google.com/groups/opt_out.



--
Thanks & Regards
   HARINATH.S

Krishnan Mahadevan

unread,
Dec 20, 2013, 2:25:57 AM12/20/13
to Selenium Users
Hari
Responding back with bits and pieces of information only delays the process of you getting a helpful answer.

So lets start from the scratch:

What version of Selenium are you working with ?
What are all the jars that you downloaded and added to your classpath ?

Please add as much context as possible to your question to help you get a speedy answer.





Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/


hari nath

unread,
Dec 20, 2013, 2:37:54 AM12/20/13
to seleniu...@googlegroups.com
1.selenium-java-2.39.0
2.selenium-java-2.39.0.jar
   selenium-java-2.39.0-srcs.jar and am using firefox 24.0



For more options, visit https://groups.google.com/groups/opt_out.

KvaSOOn

unread,
Jan 16, 2014, 11:45:33 AM1/16/14
to seleniu...@googlegroups.com
I've got a same problem! My code throws an exception NoClassDefFoundError when I'm creating WebDriver object, i was running Selenium 2.35.jar that was ok, but now I need new Selenium 2.39 cause of new Firefox that came out... I had add selenium2.39.jar as external library, but I'm still recieving this error...

Dne pátek, 20. prosince 2013 8:37:54 UTC+1 hari nath napsal(a):

KvaSOOn

unread,
Jan 20, 2014, 7:01:46 AM1/20/14
to seleniu...@googlegroups.com
Solved, you have to use selenium-server-standalone-2.39.0...

Dne čtvrtek, 16. ledna 2014 17:45:33 UTC+1 KvaSOOn napsal(a):

vamsi krishna

unread,
May 26, 2014, 5:22:33 AM5/26/14
to seleniu...@googlegroups.com
Hi guys,

I too got the same problem.. Finally solved it by adding "selenium-server-standalone-2.41.0.jar"

Thanks for the help.. :)

Madiraju K Chaitanya

unread,
May 28, 2014, 12:49:47 AM5/28/14
to seleniu...@googlegroups.com
Hi,
I have updated the latest selenium standalone server(selenium-server-standalone-2.41.0.jar) and it resolved the problem.Thank You.

Thanks and Regards,
Chaitanya


On Friday, 20 December 2013 11:57:15 UTC+5:30, hari nath wrote:
HI ALL,

When i execute my login code it showing the below error.plz help me 
my code is...

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class login {
public static void main(String[] args) throws Exception {
            WebDriver driver = new FirefoxDriver();
            driver.get("https://www.google.co.in    ");

Mayur kadu

unread,
Jul 24, 2014, 7:47:22 PM7/24/14
to seleniu...@googlegroups.com
hi
I have updated the latest jar file but still getting error

Please help out on this.its frustrating

Krishnan Mahadevan

unread,
Jul 24, 2014, 11:42:53 PM7/24/14
to seleniu...@googlegroups.com
You are the cause of your own frustrations! The root cause is very clear. You are missing a jar in your class path. What is stopping you from figuring out the correct jar and fixing the problem ? This should be pretty evident if you are conversant with Java no? If not, then stop with WebDriver and start learning Java first!

~ Krishnan

iSent. iPhone. iReget.iTypos!
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

mak

unread,
Jul 25, 2014, 4:21:36 PM7/25/14
to seleniu...@googlegroups.com

Yup i have already added the correrct jar files in classpath.

Liangjun

unread,
Sep 15, 2014, 1:54:42 AM9/15/14
to seleniu...@googlegroups.com
I met the same problem and fail even after installing the 'selenium-server-standalone-version.jar', I think you need to install the guava and guava-gwt jar (https://code.google.com/p/guava-libraries/) as well. I added all of these jar, and finally it worked in my PC. Hope it works for others facing this issue.

Sudheer

unread,
Mar 5, 2015, 11:47:14 PM3/5/15
to seleniu...@googlegroups.com
Just registered to post the solution that worked for me for the mentioned
problem

When you add the selenuim external jars, also add the jars that came along
with the selenium jars that exist in the libs folder -
F:\selenium-2.45.0\libs

This works!



--
View this message in context: http://selenium.10932.n7.nabble.com/Exception-in-thread-main-java-lang-NoClassDefFoundError-com-google-common-base-Function-at-Goto-tp31604p43136.html
Sent from the Selenium - Users mailing list archive at Nabble.com.

Michael Peterson

unread,
May 28, 2017, 12:57:54 AM5/28/17
to Selenium Users
There are many different levels of Java people in this world, and your comment below is not acceptable for helping others learn.  
Your comment, being from 2014,,,is iPainful. 
Reply all
Reply to author
Forward
0 new messages