I am trying to create Extent Report in cucumber project with EventPublisher class. Basically took help from How to implement Extent report in Cucumber using EventListener and Where to find documentation for this class

But when I am running the project, I am getting below exception

    at com.npc.qa.listeners.customReportListener.stepFinished(customReportListener.java:130)
    at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)
    at io.cucumber.core.eventbus.AbstractEventPublisher.sendAll(AbstractEventPublisher.java:36)
    at io.cucumber.core.plugin.CanonicalOrderEventPublisher.handle(CanonicalOrderEventPublisher.java:18)
    at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:44)
    at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)
    at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:107)
    at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:88)
    at io.cucumber.testng.TestNGCucumberRunner.finish(TestNGCucumberRunner.java:125)
    at io.cucumber.testng.AbstractTestNGCucumberTests.tearDownClass(AbstractTestNGCucumberTests.java:53)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
... Removed 29 stack frames
  • Please add the code where you get that exception
    – PDHide
    Commented Mar 1, 2021 at 5:11

1 Answer 1


If you check the error , the exception is thrown at com.npc.qa.listeners.customReportListener.stepFinished(customReportListener.java:130)

So check the customreporter class line 130 , the issue is caused when you try to access driver object in listner class after it is destroyed.

Unlike , testNG listner class cucumber uses an event class so it just gets the event and process In the order of Queue . It doesn't stop the code execution and so you won't be able to access the driver object inside that,as the state of driver keeps on changing as the code is still executing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.