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

Not able to run any scenario after implementing extent report - getting this error - cucumber.runtime.CucumberException: java.lang.NoSuchFieldError: VERSION_2_3_23 #96

Closed
dchoub opened this issue Jun 14, 2018 · 12 comments

Comments

@dchoub
Copy link

dchoub commented Jun 14, 2018

Dependency added in POM are:

com.relevantcodes
extentreports
2.41.2

<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.0.2</version>
 </dependency>
 <!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
	<groupId>com.aventstack</groupId>
	<artifactId>extentreports</artifactId>
	<version>3.1.5</version>
	<scope>provided</scope>
</dependency>
	<dependency>
		<groupId>org.freemarker</groupId>
		<artifactId>freemarker</artifactId>
		<version>2.3.23</version>
	</dependency>

Added below after method in Test Runner class:
@RunWith(Cucumber.class)
@CucumberOptions(
plugin={"com.cucumber.listener.ExtentCucumberFormatter:output/report.html"},
features = {"src/test/resources/feature"},
glue ={"com.mindstrength.stepdefs"},
tags={"@Profile"}

)
public class RunTest {
@afterclass
public static void setup() {
Reporter.loadXMLConfig(new File("src//test//resources//extent-config.xml"));
Reporter.setSystemInfo("user", System.getProperty("user.name"));
Reporter.setSystemInfo("os", "Mac OSX");
Reporter.setTestRunnerOutput("Sample test runner output message");
}

getting below error in console
cucumber.runtime.CucumberException: java.lang.NoSuchFieldError: VERSION_2_3_23
at cucumber.runtime.formatter.PluginFactory.instantiate(PluginFactory.java:114)
at cucumber.runtime.formatter.PluginFactory.create(PluginFactory.java:87)
at cucumber.runtime.RuntimeOptions.getPlugins(RuntimeOptions.java:241)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:287)
at com.sun.proxy.$Proxy14.uri(Unknown Source)
at cucumber.runtime.junit.JUnitReporter.uri(JUnitReporter.java:160)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:68)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.api.junit.Cucumber.run(Cucumber.java:98)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Caused by: java.lang.NoSuchFieldError: VERSION_2_3_23
at com.aventstack.extentreports.reporter.ExtentHtmlReporter.start(ExtentHtmlReporter.java:93)
at com.aventstack.extentreports.Report.attach(Report.java:55)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at com.aventstack.extentreports.ExtentReports.attachReporter(ExtentReports.java:68)
at com.cucumber.listener.ExtentCucumberFormatter.setExtentReport(ExtentCucumberFormatter.java:77)
at com.cucumber.listener.ExtentCucumberFormatter.(ExtentCucumberFormatter.java:36)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at cucumber.runtime.formatter.PluginFactory.instantiate(PluginFactory.java:107)
... 22 more

@email2vimalraj
Copy link
Owner

As mentioned in the README, the CucumberExtentReporter v3.0.2 supports ExtentReport from v3.1.1 only. Kindly upgrade your extent report version from v2.41.2 to the latest one. Thanks.

@dchoub
Copy link
Author

dchoub commented Jun 28, 2018

I have already added 3.1.5 version which is latest so I dont think so version is the issues.

com.aventstack extentreports 3.1.5 provided

@email2vimalraj
Copy link
Owner

@dchoub : Can you please provide your entire pom.xml file?

@dchoub
Copy link
Author

dchoub commented Jun 28, 2018


4.0.0

<groupId>com.mindstrength</groupId>
<artifactId>mindstrength</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Spring Boot Docker Blank Project (from https://github.com/making/spring-boot-docker-blank)</name>

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>1.2.5.RELEASE</version>
</parent>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<start-class>com.mindstrength.App</start-class>
	<java.version>1.8</java.version>
	<docker.image.prefix>${user.name}</docker.image.prefix>
</properties>

<dependencies>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-actuator</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>

	<dependency>
		<groupId>org.apache.poi</groupId>
		<artifactId>poi</artifactId>
		<version>3.6</version>
	</dependency>
	<dependency>
		<groupId>org.apache.poi</groupId>
		<artifactId>poi-ooxml</artifactId>
		<version>3.6</version>
	</dependency>
	<dependency>
		<groupId>org.apache.poi</groupId>
		<artifactId>poi-ooxml-schemas</artifactId>
		<version>3.6</version>
	</dependency>
	<dependency>
		<groupId>dom4j</groupId>
		<artifactId>dom4j</artifactId>
		<version>1.1</version>
	</dependency>
	<dependency>
		<groupId>org.apache.xmlbeans</groupId>
		<artifactId>xmlbeans</artifactId>
		<version>2.3.0</version>
	</dependency>
	<!--Selenium -->
	<dependency>
		<groupId>org.seleniumhq.selenium</groupId>
		<artifactId>selenium-java</artifactId>
		<version>2.53.0</version>
	</dependency>
	
	
		
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.0.2</version>
 </dependency>
 <!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.1.5</version>
</dependency>

<dependency>
	<groupId>org.freemarker</groupId>
	<artifactId>freemarker</artifactId>
	<version>2.3.23</version>
</dependency>


	<!-- Java mail api -->
	<dependency>
		<groupId>javax.mail</groupId>
		<artifactId>mail</artifactId>
		<version>1.4</version>
	</dependency>

	<dependency>
		<groupId>junit</groupId>
		<artifactId>junit</artifactId>
		<version>4.12</version>
	</dependency>

	<dependency>
		<groupId>info.cukes</groupId>
		<artifactId>cucumber-picocontainer</artifactId>
		<version>1.2.5</version>
	</dependency>
	<dependency>
		<groupId>info.cukes</groupId>
		<artifactId>cucumber-junit</artifactId>
		<version>1.2.4</version>
	</dependency>		
   <dependency>
      <groupId>com.googlecode.json-simple</groupId>
      <artifactId>json-simple</artifactId>
      <version>1.1.1</version>
   </dependency>
<dependency>
	<groupId>com.google.code.gson</groupId>
	<artifactId>gson</artifactId>
	<version>2.8.2</version>
</dependency>
</dependencies>
<build>
    <plugins>
	      <plugin>
	        <groupId>org.apache.maven.plugins</groupId>
	        <artifactId>maven-compiler-plugin</artifactId>
	        <version>3.7.0</version>
	        <configuration>
	          <source>1.8</source>
	          <target>1.8</target>
	           <encoding>UTF-8</encoding>          
	        </configuration>
	      </plugin>	  		      		     
  	</plugins>
</build>

@dchoub
Copy link
Author

dchoub commented Jun 29, 2018

@email2vimalraj I have posted the POM file in above comment

@email2vimalraj
Copy link
Owner

@dchoub : You have freemarker added in your dependency. It could be the reason for the exception you get as ExtentReport also have that dependency. Can you please remove the freemarker dependency and check.

@dchoub
Copy link
Author

dchoub commented Jul 2, 2018

I already tried this but same error. tried again and error is same only

@email2vimalraj
Copy link
Owner

@dchoub : Unable to reproduce your issue. I'm able to successfully run exactly with your pom dependencies. Please find the attached example project.

issue96.zip

@dchoub
Copy link
Author

dchoub commented Jul 5, 2018

I tested your project in my machine and its working fine.
I also re compiled my project and changed Runner class name from RunTest to test and run it using mvn test command and its successfully able to generate the report.

But when I am running using eclipse its still giving me same error but for your sample project its working perfectly fine. :(

@email2vimalraj
Copy link
Owner

email2vimalraj commented Jul 5, 2018 via email

@chiran1729
Copy link

@dchoub : You have freemarker added in your dependency. It could be the reason for the exception you get as ExtentReport also have that dependency. Can you please remove the freemarker dependency and check.

Thank you so much. It helped me. :)
Cheers..!!

@ZeynepUsta
Copy link

@dchoub : You have freemarker added in your dependency. It could be the reason for the exception you get as ExtentReport also have that dependency. Can you please remove the freemarker dependency and check.

Thank you so much. It helped me. :)
Cheers..!!

Helped me too! Thanks!

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

4 participants