Selenium2Example getting ClassNotFoundException

3,270 views
Skip to first unread message

Arthur

unread,
Mar 30, 2011, 6:17:33 AM3/30/11
to webdriver
I'm running the Selenium2Example that is shown on this page
http://seleniumhq.org/docs/03_webdriver.html

I have a single class Selenium2Example and I have the selenium-
java-2.0b3.jar on my classpath

When I run this I get the following thrown when trying to execute
WebDriver driver = new FirefoxDriver(); :

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/
common/base/Function
at Selenium2Example.main(Selenium2Example.java:11)
Caused by: java.lang.ClassNotFoundException:
com.google.common.base.Function
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)

Does the FirefoxDriver require that I import some
com.google.common.base.Function lib or should that already be in the
selenium-java-2.0b3.jar?

Darren Rowley

unread,
Mar 30, 2011, 4:05:33 PM3/30/11
to webdriver
Looks like you are missing the jar file guava-r08.jar from your
classpath, this and probably other jars you are missing are in the
'libs' folder of the Selenium distribution you downloaded. I believe
there is also a 'standalone' version you can get that has all the
dependencies bundled.

d.


On Mar 30, 11:17 pm, Arthur <aemble...@gmail.com> wrote:
> I'm running the Selenium2Example that is shown on this pagehttp://seleniumhq.org/docs/03_webdriver.html
Reply all
Reply to author
Forward
0 new messages