CucumberExtentReporter icon indicating copy to clipboard operation
CucumberExtentReporter copied to clipboard

getting gherkin/formatter/Formatter

Open Ajay0427 opened this issue 7 years ago • 38 comments

java.lang.NoClassDefFoundError: gherkin/formatter/Formatter at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at cucumber.runtime.formatter.PluginFactory$1.(PluginFactory.java:53) at cucumber.runtime.formatter.PluginFactory.(PluginFactory.java:52) at cucumber.runtime.RuntimeOptionsFactory.addPlugins(RuntimeOptionsFactory.java:90) at cucumber.runtime.RuntimeOptionsFactory.buildArgsFromOptions(RuntimeOptionsFactory.java:37) at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:24) at cucumber.api.junit.Cucumber.(Cucumber.java:56) 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 org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.ClassNotFoundException: gherkin.formatter.Formatter at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 35 more

Ajay0427 avatar Aug 01 '17 11:08 Ajay0427

Do you have the cucumber and gherkin libraries added in your dependencies?

email2vimalraj avatar Aug 06 '17 02:08 email2vimalraj

Hello Vimal,

Yes, I have both the libraries in dependencies Cucumber Java and junit -1.2.5 Gherkin -2.12.2

Regards, Ajay Jaiswal

On Sun, 6 Aug 2017 at 8:23 AM, VimalRaj Selvam [email protected] wrote:

Do you have the cucumber and gherkin libraries added in your dependencies?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/email2vimalraj/CucumberExtentReporter/issues/59#issuecomment-320482212, or mute the thread https://github.com/notifications/unsubscribe-auth/AT0_u0oK9HBo2VVY45LQTlxPbpUxC7qPks5sVSqygaJpZM4Opmxb .

Ajay0427 avatar Aug 11 '17 14:08 Ajay0427

Hi Vimal,

I am also facing this same issue, do we have a solution for this ? Do I need to update the gherkin version ? Please do let me know.

Thanks and Regards, Adarsh

adarshkv avatar Oct 26 '17 09:10 adarshkv

I am also facing this issue.

Is there a fix coming?

lewisob avatar Oct 31 '17 23:10 lewisob

I am also facing the same problem. I am using cucumber-java-1.25.jar, junit-4.12.jar, gherking-2.12.2.jar

Can someone help me out?

srirambk avatar Nov 06 '17 06:11 srirambk

I am also facing same issue. cucumber-java-1.25.jar, junit-4.12.jar, gherkin-2.12.2.jar is there any fix?

nrsawalw avatar Dec 24 '17 04:12 nrsawalw

I'll look into it, but no timelines for now. I appreciate PR if you're interested in it.

On 24-Dec-2017 10:01 AM, "nrsawalw" [email protected] wrote:

I am also facing same issue. cucumber-java-1.25.jar, junit-4.12.jar, gherkin-2.12.2.jar is there any fix?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/email2vimalraj/CucumberExtentReporter/issues/59#issuecomment-353764847, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKI3iCsM8lVI0FsfNHU9Ow5HwBjenE4ks5tDdOVgaJpZM4Opmxb .

email2vimalraj avatar Dec 24 '17 04:12 email2vimalraj

Hi Vimal,

Thanks for reply, please look into this issue and let me know if you required any details.

nrsawalw avatar Dec 24 '17 04:12 nrsawalw

Can anyone of you please post the sample project with the pom file? I'm unable to reproduce this issue.

email2vimalraj avatar Jan 04 '18 03:01 email2vimalraj

I am facing similar issue with TestNG

it-shivani avatar Feb 01 '18 22:02 it-shivani

Hi, I was facing the same issue. The following is the step of how I fixed it: I checked the gherkin version in my pom.xml and Referenced Libraries -> gherkin/formatter/Formatter was there. so the class could be found while not. I guess it may be difficult to solve this issue from pom...therefore I upload that jar file directly to the library...then it fixed finally and work well. Hope it is useful for you.

charlenezheng avatar Feb 07 '18 17:02 charlenezheng

Do you mean you explicitly uploaded jars related to extent reports? I tried that but still getting the same null pointer exception.

it-shivani avatar Feb 07 '18 19:02 it-shivani

Anyone got any solution for this error?

smsmandale avatar Mar 22 '18 08:03 smsmandale

I have faced the similar issue today... when i googled i found the problem is with the .m2 repository. Steps:

  1. go to .m2\repository\info\cukes\
  2. delete the gherkin folder from this directory. (Seems to be corrupted)
  3. Now set gherkin 2.12.2 version in the pom.xml and save and run your test.

It worked for me. Hope it is useful for you....

mksmanyam avatar Mar 26 '18 10:03 mksmanyam

Thanks mksmanyam your suggestion finally worked for me

poojagaut avatar Jun 11 '18 00:06 poojagaut

I can confirm this issue still exists as of 3.1.0. As @mksmanyam mentioned, a workaround is to explicitly include gherkin in your pom.xml:

<!-- https://mvnrepository.com/artifact/info.cukes/gherkin -->
<dependency>
	<groupId>info.cukes</groupId>
	<artifactId>gherkin</artifactId>
	<version>2.12.2</version>
	<scope>provided</scope>
</dependency>

kathyrollo avatar Jul 21 '18 05:07 kathyrollo

Hi @email2vimalraj ,

Feel free to pull this branch: https://github.com/kathyrollo/jcucumberng-framework/tree/issue-42

I have placed the workaround in that branch. If you remove gherkin from the pom, you will be able to replicate this issue.

kathyrollo avatar Jul 21 '18 06:07 kathyrollo

Thanks mksmanyam for the help.

kudarichetan avatar Sep 07 '18 06:09 kudarichetan

I can confirm this issue still exists as of 3.1.0. As @mksmanyam mentioned, a workaround is to explicitly include gherkin in your pom.xml:

<!-- https://mvnrepository.com/artifact/info.cukes/gherkin -->
<dependency>
	<groupId>info.cukes</groupId>
	<artifactId>gherkin</artifactId>
	<version>2.12.2</version>
	<scope>provided</scope>
</dependency>

Resolved, Thankyou

tapanagkumar avatar Sep 15 '18 21:09 tapanagkumar

2.12.2

I did the same but still I am getting below error

cucumber.runtime.CucumberException: Couldn't load plugin class: com.vimalselvam.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin

I am using below dependencies along with gherkin dependency

<dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-spring</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java8</artifactId>
        <version>2.3.1</version>
    </dependency>

Please help me to understand what dependencies you have

Thanks in advance..!!

Udhay1316 avatar Oct 09 '18 22:10 Udhay1316

I m also getting the same issue on cucumber version: 2.4.0

cucumber.runtime.CucumberException: Couldn't load plugin class:

@mksmanyam / @kathyrollo: How did you fix this issue? I tried those steps as well, however, did not get any success

I provided below dependency in my POM.xml file

info.cukes gherkin 2.12.2 provided

I tried to manually too to place proper JAR file.

Could you please help me on this

ghost avatar Oct 14 '18 08:10 ghost

2.12.2

I did the same but still I am getting below error

cucumber.runtime.CucumberException: Couldn't load plugin class: com.vimalselvam.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin

I am using below dependencies along with gherkin dependency

<dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-spring</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java8</artifactId>
        <version>2.3.1</version>
    </dependency>

Please help me to understand what dependencies you have

Thanks in advance..!!

Hello,

I have seen and tried from your code with cucumber-spring and cucumber java8 which didn't work so then I was using the below dependency with latest versions and it was working.

<dependency>
      <groupId>io.cucumber</groupId>
      <artifactId>cucumber-junit</artifactId>
      <version>2.4.0</version>
    </dependency>
    <dependency>
      <groupId>io.cucumber</groupId>
      <artifactId>cucumber-java</artifactId>
      <version>2.4.0</version>
    </dependency>
    <dependency>
      <groupId>info.cukes</groupId>
      <artifactId>gherkin</artifactId>
      <version>2.12.2</version>
      <scope>provided</scope>
    </dependency>

Hope this helps.

vamc264 avatar Oct 29 '18 11:10 vamc264

I tried with the above mentioned dependencies but I am getting the same error

cucumber.runtime.CucumberException: Couldn't load plugin class: com.vimalselvam.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin

Note: Mine is Cucumner-Spring and Cucumber-java8 NOT Cucucmber-java

Thanks Udhay

On Mon, Oct 29, 2018 at 6:23 AM vamc264 [email protected] wrote:

2.12.2

I did the same but still I am getting below error

cucumber.runtime.CucumberException: Couldn't load plugin class: com.vimalselvam.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin

I am using below dependencies along with gherkin dependency

io.cucumber cucumber-spring 2.3.1 io.cucumber cucumber-java8 2.3.1

Please help me to understand what dependencies you have

Thanks in advance..!!

Hello,

I have seen and tried from your code with cucumber-spring and cucumber java8 which didn't work so then I was using the below dependency with latest versions and it was working.

io.cucumber cucumber-junit 2.4.0 io.cucumber cucumber-java 2.4.0 info.cukes gherkin 2.12.2 provided

Hope this helps.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/email2vimalraj/CucumberExtentReporter/issues/59#issuecomment-433875412, or mute the thread https://github.com/notifications/unsubscribe-auth/AkA0Vl0AiLhv_gDGwRAOL32ymO9rzJEXks5upuUkgaJpZM4Opmxb .

--

Udhay Gajula91-9618181880 Okkaraithe Ontari, Okkataithe Uppena...

Udhay1316 avatar Oct 29 '18 20:10 Udhay1316

Hi All ,

While running the cucumber file with selenium , its giving the below error:

java.lang.NoClassDefFoundError: gherkin/formatter/Formatter at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) 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) at cucumber.runtime.formatter.PluginFactory$1.(PluginFactory.java:53) at cucumber.runtime.formatter.PluginFactory.(PluginFactory.java:52) at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:70) at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:25) at cucumber.api.junit.Cucumber.(Cucumber.java:56) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.ClassNotFoundException: gherkin.formatter.Formatter 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) ... 35 more

Used Below Jars cucumber-core-1.2.5 junit-4.12 gherkin-2.12.2-javadoc hamcrest-core-1.3 cucumber-reporting-4.2.3 cucumber-jvm-deps-1.0.5 cucumber-junit-1.2.5 cucumber-java-1.2.5 cobertura-2.1.1 cucumber-html-0.2.6

jre1.8.0_191 Selenium standalone (3.141.59.jar)

I have attached all relevant screenshot . MyTest.feature @tag Feature: Reset functionality on login page of Application

@tag1 Scenario: Verification of Reset button Given Open the Chrome and launch the application When Enter the Username and Password Then Reset the credential

Runner.java package StepDefinition;

import org.junit.runner.RunWith; import cucumber.api.junit.Cucumber; import cucumber.api.CucumberOptions;

@RunWith(Cucumber.class) @CucumberOptions(features="StepDefinition",glue={"StepDefinition"})

public class Runner {

}

Steps.java

package StepDefinition; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When;

public class Steps {

@Given("^Open the Chrome and launch the application$")

public void Open_the_Chrome_and_launch_the_application()throws Throwable 
{
	System.out.println("This step open the Chrome and lauch the browser.");
}


@When("^Enter the Username and Password$")

public void Enter_the_Username_and_Password()throws Throwable

{		
       System.out.println("This step enter the Username and Password on the login page.");					
    }		

    @Then("^Reset the credential$")					
    public void Reset_the_credential() throws Throwable 							
    {    		
        System.out.println("This step click on the Reset button.");					
    }		

}

suite

Vjoshi123 avatar Dec 13 '18 13:12 Vjoshi123

Im also hitting same issue:

cucumber.runtime.CucumberException: Couldn't load plugin class: com.vimalselvam.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin

Im using below dependencies:

<artifactId>cucumber-java</artifactId> 4.2.6

<groupId>info.cukes</groupId> <artifactId>gherkin</artifactId> 2.12.2

Please let me know solution.

kavyamurthy1209 avatar Mar 26 '19 11:03 kavyamurthy1209

@email2vimalraj , bro check the POM.xml, I am getting error `java.lang.NoClassDefFoundError: gherkin/formatter/Reporter at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(Unknown Source) at java.base/java.security.SecureClassLoader.defineClass(Unknown Source) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(Unknown Source) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(Unknown Source) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) at cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:171) at cucumber.runtime.formatter.PluginFactory.pluginClass(PluginFactory.java:163) at cucumber.runtime.formatter.PluginFactory.getPluginClass(PluginFactory.java:220) at cucumber.runtime.formatter.PluginFactory.isStepDefinitionReporterName(PluginFactory.java:203) at cucumber.runtime.RuntimeOptions$ParsedPluginData.addPluginName(RuntimeOptions.java:386) at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:165) at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:108) at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:101) at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:97) at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:23) at cucumber.api.junit.Cucumber.(Cucumber.java:83) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:525) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209) Caused by: java.lang.ClassNotFoundException: gherkin.formatter.Reporter at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ... 37 more

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>

<groupId>packageName</groupId>
<artifactId>projectName</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>projectName</name>
<url>http://maven.apache.org</url>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<junit.version>4.12</junit.version>
</properties>

<dependencies>
	<dependency>
		<groupId>junit</groupId>
		<artifactId>junit</artifactId>
		<version>${junit.version}</version>
		<scope>test</scope>
	</dependency>
	<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java8 -->
	<dependency>
		<groupId>io.cucumber</groupId>
		<artifactId>cucumber-java8</artifactId>
		<version>4.2.6</version>
	</dependency>
	<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
	<dependency>
		<groupId>io.cucumber</groupId>
		<artifactId>cucumber-junit</artifactId>
		<version>4.2.6</version>
		<scope>test</scope>
	</dependency>
	<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm-deps -->
	<dependency>
		<groupId>io.cucumber</groupId>
		<artifactId>cucumber-jvm-deps</artifactId>
		<version>1.0.6</version>
		<scope>provided</scope>
	</dependency>
	<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
	<dependency>
		<groupId>org.seleniumhq.selenium</groupId>
		<artifactId>selenium-java</artifactId>
		<version>3.141.59</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/net.masterthought/cucumber-reporting -->
	<dependency>
		<groupId>com.vimalselvam</groupId>
		<artifactId>cucumber-extentsreport</artifactId>
		<version>3.1.1</version>
	</dependency>
	<dependency>
		<groupId>com.aventstack</groupId>
		<artifactId>extentreports</artifactId>
		<version>3.1.1</version>
	</dependency>
	<!-- https://mvnrepository.com/artifact/io.cucumber/gherkin -->
	<dependency>
		<groupId>io.cucumber</groupId>
		<artifactId>gherkin</artifactId>
		<version>2.12.2</version>
	</dependency>

</dependencies>
<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.8.0</version>
			<configuration>
				<fork>true</fork>
				<!-- Added by Partha -->
				<source>10</source>
				<target>10</target>
			</configuration>
		</plugin>

	</plugins>
</build>
`

pikomdas avatar Apr 23 '19 07:04 pikomdas

use this version it solves <groupId>info.cukes</groupId> <artifactId>gherkin</artifactId> 2.7.3

rajesh-app avatar Sep 03 '19 13:09 rajesh-app

Still i am facing same issue java.lang.NoClassDefFoundError: gherkin/formatter/Formatter

using below version in POM cucumber-junit - 4.8.0 cucumber-java - 4.8.0 gherkin - 6.0.13

sseenivasan89 avatar Nov 08 '19 09:11 sseenivasan89

Still i am facing same issue java.lang.NoClassDefFoundError: gherkin/formatter/Formatter

using below version in POM cucumber-junit - 4.7.4 cucumber-java - 4.7.4 gherkin - 5.2.0

chik145 avatar Jan 03 '20 04:01 chik145

@chik145 Have a look at the version 4 adapter here: https://github.com/extent-framework/extentreports-cucumber4-adapter

anshooarora avatar Jan 03 '20 04:01 anshooarora

@anshooarora i am using 1.0.8 version of version 4 adapter but still same issue. this is my POM

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>Compas_GO_UI</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <cucumber.version>4.7.4</cucumber.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-core</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>

    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.6</version>
    </dependency>

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

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>5.5.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports-cucumber4-adapter</artifactId>
        <version>1.0.8</version>
    </dependency>

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

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>gherkin</artifactId>
        <version>5.2.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>4.1.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>4.1.1</version>
    </dependency>

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

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.2</version>
            <configuration>
                <testSourceDirectory>${basedir}/src/main/java/tests</testSourceDirectory>
                <testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
                <includes>
                    <include>**/*Runner*.java</include>
                </includes>
                <parallel>all</parallel>
                <useUnlimitedThreads>true</useUnlimitedThreads>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

chik145 avatar Jan 03 '20 08:01 chik145

Please open the issue in the relevant adapter's repo and share the details.

Would suggest removing the extentreports dependency as the adapter will resolve it anyways.

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

anshooarora avatar Jan 03 '20 08:01 anshooarora

@anshooarora As the cucumber extent report is having issue, so i cannot remove the above dependency. as we are considering it as our primary report.

chik145 avatar Jan 06 '20 09:01 chik145

Hi, I was facing the same issue. The following is the step of how I fixed it: I checked the gherkin version in my pom.xml and Referenced Libraries -> gherkin/formatter/Formatter was there. so the class could be found while not. I guess it may be difficult to solve this issue from pom...therefore I upload that jar file directly to the library...then it fixed finally and work well. Hope it is useful for you.

Please let me know the new gherkin version.

Greeshma-babu avatar Mar 14 '20 03:03 Greeshma-babu

Below MAVEN dependency works for me, hope it helps:

info.cukes cucumber-jvm 1.2.5 pom info.cukes cucumber-jvm-deps 1.0.5 provided net.masterthought cucumber-reporting 4.11.2 org.seleniumhq.selenium selenium-java 3.141.59 junit junit 4.12 test io.cucumber cucumber-junit 2.4.0
<dependency>
  <groupId>io.cucumber</groupId>
  <artifactId>cucumber-java</artifactId>
  <version>2.4.0</version>
</dependency>

<dependency>
  <groupId>info.cukes</groupId>
  <artifactId>gherkin</artifactId>
  <version>2.12.2</version>
  <scope>provided</scope>
</dependency>

erkkpankaj avatar Mar 26 '20 04:03 erkkpankaj

I am facing similar issue with TestNG

Me too have you found the soutions? please share to me if you found the solution

ksujeet568 avatar Apr 14 '20 06:04 ksujeet568

I am facing the same error. Below is my maven dependencies

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <gherkin.version>5.1.0</gherkin.version>
        <cucumber.version>4.7.2</cucumber.version>
    </properties>
<dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>RELEASE</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-path</artifactId>
            <version>RELEASE</version>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>xml-path</artifactId>
            <version>RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20190722</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>gherkin</artifactId>
            <version>${gherkin.version}</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>${cucumber.version}</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cucumber.version}</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <version>${cucumber.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

sudheerah avatar May 17 '20 12:05 sudheerah

This POM.xml works fine for me, you can pick the required dependency:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>

<groupId>CucumberDemo</groupId>
<artifactId>IVLCucumberAutomation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>IVLCucumberAutomation</name>
<url>http://maven.apache.org</url>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>

	<dependency>
		<groupId>io.cucumber</groupId>
		<artifactId>cucumber-testng</artifactId>
		<version>2.0.0</version>
	</dependency>

	<dependency>
		<groupId>log4j</groupId>
		<artifactId>log4j</artifactId>
		<version>1.2.17</version>
	</dependency>

	<dependency>
		<groupId>info.cukes</groupId>
		<artifactId>cucumber-jvm</artifactId>
		<version>1.2.5</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>net.masterthought</groupId>
		<artifactId>cucumber-reporting</artifactId>
		<version>4.11.2</version>
	</dependency>

	<dependency>
		<groupId>org.seleniumhq.selenium</groupId>
		<artifactId>selenium-java</artifactId>
		<version>3.141.59</version>
	</dependency>

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

	<dependency>
		<groupId>io.cucumber</groupId>
		<artifactId>cucumber-junit</artifactId>
		<version>2.4.0</version>
	</dependency>

	<dependency>
		<groupId>io.cucumber</groupId>
		<artifactId>cucumber-java</artifactId>
		<version>2.4.0</version>
	</dependency>
	
	<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
</dependencies>
<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-resources-plugin</artifactId>
			<version>2.4</version>
		</plugin>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-surefire-plugin</artifactId>
			<version>2.19.1</version>
			<configuration>
				<testFailureIgnore>true </testFailureIgnore>
				<suiteXmlFiles>
					<!-- src/test/resources/testSuites/testng.xml -->
					<suiteXmlFile>testNg.xml</suiteXmlFile>
				</suiteXmlFiles>
			</configuration>
		</plugin>
		<plugin>
			<groupId>net.masterthought</groupId>
			<artifactId>maven-cucumber-reporting</artifactId>
			<version>3.8.0</version>
			<executions>
				<execution>
					<id>execution</id>
					<!-- <phase>verify</phase> -->
					<goals>
						<goal>generate</goal>
					</goals>
					<configuration>
						<projectName>IVLCucumberDemo</projectName>  <!-- Replace with project name -->
						<outputDirectory>target/cucumber-reports/advanced-reports</outputDirectory>
						<cucumberOutput>target/cucumber-reports/CucumberTestReport.json</cucumberOutput>
						<buildNumber>1</buildNumber>
						<parallelTesting>false</parallelTesting>
					</configuration>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

erkkpankaj avatar Jun 15 '20 05:06 erkkpankaj