Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ExtentHtmlReporter #121

Open
KonkaKrish opened this issue Dec 30, 2020 · 1 comment

Comments

@KonkaKrish
Copy link

Getting Below error, please help me guys spent a lot of time to fix this issue and no luck so far

Not getting extent reports - tried many ways and got struck, provided below my POM.xml and runner file- much appreciate your help in advance!


FAILED CONFIGURATION: @afterclass extentReport
java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ExtentHtmlReporter
at com.cucumber.listener.Reporter.loadXMLConfig(Reporter.java:56)
at com.API.runner.CucumberRunner.extentReport(CucumberRunner.java:34)
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.invokeConfigurationMethod(Invoker.java:514)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:232)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:115)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
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:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:113)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:206)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:177)
Caused by: java.lang.ClassNotFoundException: com.aventstack.extentreports.reporter.ExtentHtmlReporter
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)
... 26 more #

My POM.xml
-----------------

4.0.0
Cucumber_API
Cucumber_API
0.0.1-SNAPSHOT

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	<java.version>1.8</java.version>
</properties>

<dependencies>
	<dependency>
		<groupId>org.testng</groupId>
		<artifactId>testng</artifactId>
		<version>6.9.9</version>
	</dependency>
	<dependency>
		<groupId>org.apache.poi</groupId>
		<artifactId>poi</artifactId>
		<version>4.0.1</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
	<dependency>
		<groupId>org.apache.poi</groupId>
		<artifactId>poi-ooxml</artifactId>
		<version>4.0.1</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
	<dependency>
		<groupId>org.apache.poi</groupId>
		<artifactId>poi-ooxml-schemas</artifactId>
		<version>4.0.1</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
	<dependency>
		<groupId>io.rest-assured</groupId>
		<artifactId>rest-assured</artifactId>
		<version>4.1.2</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
	<dependency>
		<groupId>com.aventstack</groupId>
		<artifactId>extentreports</artifactId>
		<version>5.0.6</version>
	</dependency>

	<dependency>
		<groupId>com.relevantcodes</groupId>
		<artifactId>extentreports</artifactId>
		<version>2.41.2</version>
	</dependency>
	
	<!-- https://mvnrepository.com/artifact/com.vimalselvam/cucumber-extentsreport -->
	<dependency>
	    <groupId>com.vimalselvam</groupId>
	    <artifactId>cucumber-extentsreport</artifactId>
	    <version>3.1.1</version>
	</dependency>
	
	<dependency>
		<groupId>info.cukes</groupId>
		<artifactId>cucumber-testng</artifactId>
		<version>1.2.6</version>
	</dependency>

	<dependency>
		<groupId>net.masterthought</groupId>
		<artifactId>cucumber-reporting</artifactId>
		<version>5.4.0</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
	<dependency>
	    <groupId>info.cukes</groupId>
	    <artifactId>cucumber-java</artifactId>
	    <version>1.2.6</version>
	    <type>pom</type>
	</dependency>

	<dependency>
	    <groupId>info.cukes</groupId>
	    <artifactId>cucumber-jvm-deps</artifactId>
	    <version>1.0.5</version>
	    <scope>provided</scope>
	</dependency>
	
	<dependency>
		<groupId>info.cukes</groupId>
		<artifactId>cucumber-picocontainer</artifactId>
		<version>1.2.6</version>
	</dependency>

	<dependency>
	    <groupId>info.cukes</groupId>
	    <artifactId>cucumber-junit</artifactId>
	    <version>1.2.6</version>
	</dependency>

</dependencies>

Runner.Java
-----------------
import java.io.File;
import org.testng.annotations.AfterClass;
import com.API.report.reportHelp;
import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;

@CucumberOptions(strict = true, monochrome = true, features = "src/test/resources/features", glue = "com.API.StepDef", plugin = {
		"pretty", "json:target/cucumber.json","com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html"})

public class CucumberRunner extends AbstractTestNGCucumberTests {


	@AfterClass(alwaysRun = true)
	public void extentReport() throws Exception {
		Reporter.loadXMLConfig(new File("src/test/resources/extent-config.xml"));

        
	}

}
@StefaneAL
Copy link

StefaneAL commented Mar 30, 2021

What if you try to use
"com.vimalselvam.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html"
instead of
"com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html"

assuming that

<dependency>
	    <groupId>com.vimalselvam</groupId>
	    <artifactId>cucumber-extentsreport</artifactId>
	    <version>3.1.1</version>
	</dependency>

or replace

<dependency>
		<groupId>com.aventstack</groupId>
		<artifactId>extentreports</artifactId>
		<version>5.0.6</version>
	</dependency>

for

<dependency>
		<groupId>com.aventstack</groupId>
		<artifactId>extentreports</artifactId>
		<version>3.0.7</version>
	</dependency>

Good luck

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants