Exception : java.lang.NoClassDefFoundError: com/google/commo | Selenium Forum
M
Posted on 29/09/2016
hi Team,

while working with Testng data providers facing this issue:
I am getting this exception when i execute the testclass file, kindly help. I also added Guava-master.jar and guava-r07.jar after google on issue.

[color=#40FF00:2ld6m1mn]My Test Class file: TestUsingDataProvider [/color:2ld6m1mn]
=================================================
package javalearning;

import org.testng.annotations.Test;


public class TestUsingDataProvider {

//Test creation using priority and data provider
@Test(priority=1,dataProviderClass=javalearning.SampleTestdataProvider.class,dataProvider="mymaillogindataprovider")
public void Login_myemail(String username, String password){
System.out.println("I am now in Login Gmail Test");
System.out.println(username + "" + password);


}


}
==================================================================
[color=#008000:2ld6m1mn]My data provider class file: SampleTestdataProvider[/color:2ld6m1mn]


package javalearning;

import org.testng.annotations.DataProvider;

public class SampleTestdataProvider {

@DataProvider(name="mymaillogindataprovider")

public static Object[][] getDatagmaillogin(){
Object data[][] = new Object[2][2];

data[0][0]="U1";
data[0][1]="P1";
//data[0][2]="xyz@gmail.com";

data[1][0]="U2";
data[1][1]="P2";
//data[1][2]="abc@gmail.com";

return data;

}
}
=============================================================
[color=#FF0000:2ld6m1mn]Exception when I run as Testng:[/color:2ld6m1mn]
[TestNG] Running:
C:\temp\testng-eclipse--2139131466\testng-customsuite.xml

[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\Default suite\Default test.xml
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\Default suite exists: true
SKIPPED: Login_myemail
java.lang.NoClassDefFoundError: com/google/common/primitives/Ints
at org.testng.internal.annotations.JDK15TagFactory.createDataProviderTag(JDK15TagFactory.java:335)
at org.testng.internal.annotations.JDK15TagFactory.createTag(JDK15TagFactory.java:59)
at org.testng.internal.annotations.JDK15AnnotationFinder.findAnnotation(JDK15AnnotationFinder.java:217)
at org.testng.internal.annotations.JDK15AnnotationFinder.findAnnotation(JDK15AnnotationFinder.java:111)
at org.testng.internal.Parameters.findDataProvider(Parameters.java:326)
at org.testng.internal.Parameters.findDataProvider(Parameters.java:261)
at org.testng.internal.Parameters.handleParameters(Parameters.java:418)
at org.testng.internal.Invoker.handleParameters(Invoker.java:1240)
at org.testng.internal.Invoker.createParameters(Invoker.java:980)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1070)
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:746)
at org.testng.TestRunner.run(TestRunner.java:600)
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:1264)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1189)
at org.testng.TestNG.runSuites(TestNG.java:1104)
at org.testng.TestNG.run(TestNG.java:1076)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:152)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:57)
Caused by: java.lang.ClassNotFoundException: com.google.common.primitives.Ints
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)
... 27 more


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


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

[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite\toc.html
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite\Default test.properties
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite\index.html
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite\main.html
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite\groups.html
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite\classes.html
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite\reporter-output.html
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite\methods-not-run.html
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite\testng.xml.html
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old\index.html
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\old exists: true
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@75c597: 93 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@1cfde49: 32 ms
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\testng-failed.xml
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output exists: true
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\Default suite\testng-failed.xml
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\Default suite exists: true
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 15 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@13ba11c: 47 ms
[Utils] Attempting to create C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\junitreports\TEST-javalearning.TestUsingDataProvider.xml
[Utils] Directory C:\Documents and Settings\jogparag\javalearning\javalearning\test-output\junitreports exists: true
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@16d2378: 16 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@4f2b6c: 15 ms
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:"C:\Program Files\HP\Unified Functional Testing\bin\java_shared\classes";"C:\Program Files\HP\Unified Functional Testing\\bin\java_shared\classes\jasmine.jar"

M
Replied on 30/09/2016

http://stackoverflow.com/questions/38483832/testng-java-lang-noclassdeffounderror-com-google-common-primitives-ints