No class found exception while start selenium | Selenium Forum
M
Posted on 31/05/2016
package qwerty;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
import com.google.common.base.Function;

public class kop {

public WebDriver driver;

@Test
public void test()
{
driver = new FirefoxDriver();
driver.get("https://www.irctc.co.in/");
driver.quit();

}

}


I am using above code to start selenium. But i got below error message.


[TestNG] Running:
C:\Users\pc\AppData\Local\Temp\testng-eclipse--1846684029\testng-customsuite.xml

[Utils] Attempting to create C:\Java\test-output\Default suite\Default test.html
[Utils] Directory C:\Java\test-output\Default suite exists: true
[Utils] Attempting to create C:\Java\test-output\Default suite\Default test.xml
[Utils] Directory C:\Java\test-output\Default suite exists: true
FAILED: test
java.lang.NoClassDefFoundError: com/google/common/io/Resources
at org.openqa.selenium.firefox.FirefoxProfile.onlyOverrideThisIfYouKnowWhatYouAreDoing(FirefoxProfile.java:128)
at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:85)
at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:78)
at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:67)
at org.openqa.selenium.firefox.FirefoxDriver.getProfile(FirefoxDriver.java:288)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:264)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at iiqwerty.kop.test(kop.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:646)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:823)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:778)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1225)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1150)
at org.testng.TestNG.runSuites(TestNG.java:1075)
at org.testng.TestNG.run(TestNG.java:1047)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)
Caused by: java.lang.ClassNotFoundException: com.google.common.io.Resources
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)
... 37 more


===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
===============================================


===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

[Utils] Attempting to create C:\Java\test-output\testng-failed.xml
[Utils] Directory C:\Java\test-output exists: true
[Utils] Attempting to create C:\Java\test-output\Default suite\testng-failed.xml
[Utils] Directory C:\Java\test-output\Default suite exists: true
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 12 ms
[Utils] Problem creating output directory C:\Java\test-output\old\Default suite
[Utils] Attempting to create C:\Java\test-output\old\Default suite\toc.html
[Utils] Directory C:\Java\test-output\old\Default suite exists: true
[Utils] Problem creating output directory C:\Java\test-output\old\Default suite
[Utils] Attempting to create C:\Java\test-output\old\Default suite\Default test.properties
[Utils] Directory C:\Java\test-output\old\Default suite exists: true
[Utils] Problem creating output directory C:\Java\test-output\old\Default suite
[Utils] Attempting to create C:\Java\test-output\old\Default suite\index.html
[Utils] Directory C:\Java\test-output\old\Default suite exists: true
[Utils] Problem creating output directory C:\Java\test-output\old\Default suite
[Utils] Attempting to create C:\Java\test-output\old\Default suite\main.html
[Utils] Directory C:\Java\test-output\old\Default suite exists: true
[Utils] Problem creating output directory C:\Java\test-output\old\Default suite
[Utils] Attempting to create C:\Java\test-output\old\Default suite\groups.html
[Utils] Directory C:\Java\test-output\old\Default suite exists: true
[Utils] Problem creating output directory C:\Java\test-output\old\Default suite
[Utils] Problem creating output directory C:\Java\test-output\old\Default suite
[Utils] Problem creating output directory C:\Java\test-output\old\Default suite
[Utils] Attempting to create C:\Java\test-output\old\Default suite\classes.html
[Utils] Directory C:\Java\test-output\old\Default suite exists: true
[Utils] Problem creating output directory C:\Java\test-output\old\Default suite
[Utils] Attempting to create C:\Java\test-output\old\Default suite\reporter-output.html
[Utils] Directory C:\Java\test-output\old\Default suite exists: true
[Utils] Problem creating output directory C:\Java\test-output\old\Default suite
[Utils] Attempting to create C:\Java\test-output\old\Default suite\methods-not-run.html
[Utils] Directory C:\Java\test-output\old\Default suite exists: true
[Utils] Problem creating output directory C:\Java\test-output\old\Default suite
[Utils] Attempting to create C:\Java\test-output\old\Default suite\testng.xml.html
[Utils] Directory C:\Java\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Java\test-output\old\index.html
[Utils] Directory C:\Java\test-output\old exists: true
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@35bbe5e8: 97 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@1cd072a9: 12 ms
[Utils] Attempting to create C:\Java\test-output\junitreports\TEST-iiqwerty.kop.xml
[Utils] Directory C:\Java\test-output\junitreports exists: true
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@2133c8f8: 15 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@58ceff1: 13 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@3cb5cdba: 65 ms

M
Replied on 31/05/2016

download and add selenium again.