It was working for me. I have closed Eclipse and executed the same runner(BDD, with Maven Project). I am getting the error:
java.lang.NoSuchMethodError: 'byte[] org.apache.commons.io.IOUtils.byteArray(int)' at org.apache.commons.io.output.AbstractByteArrayOutputStream.needNewBuffer(AbstractByteArrayOutputStream.java:104) at org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream.(UnsynchronizedByteArrayOutputStream.java:51) at org.apache.poi.util.IOUtils.peekFirstNBytes(IOUtils.java:139) at org.apache.poi.poifs.filesystem.FileMagic.valueOf(FileMagic.java:209) at org.apache.poi.openxml4j.opc.internal.ZipHelper.verifyZipHeader(ZipHelper.java:143) at org.apache.poi.openxml4j.opc.internal.ZipHelper.openZipStream(ZipHelper.java:175) at org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:130) at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:312) at org.apache.poi.ooxml.util.PackageHelper.open(PackageHelper.java:59) at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:289) at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:285) at StepDefinition.Steps.when_user_enters_filename(Steps.java:80) at ✽.a user enters "C:\Sejars\TestData.xlsx" and "Sheet1"(file:///C:/Users/Ashok%20Kumar/eclipse-workspace/CucumberWithSelenium/Features/MyTest.feature:20)
Infact it was working for me. But all of sudden it has started throwing errors. I have referred the previous posting suggested during posting this. One of the suggestions is to include ">poi-ooxml". But my POM is already having the same. I have changed the version of commons-io version. But still no use. Same error. Note that no error while building the code and build is successful at CMD prompt. But it's throwing at runtime is surpring me. I am using Eclipse and my JDK version is 17.0.2 and Maven version is: 3.8.5 Here I am listing 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>CucumberWithSelenium</groupId>
<artifactId>CucumberWithSelenium</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.2.3</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.2.3</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>22.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-picocontainer -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>7.2.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.10.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-log4j2 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<version>2.6.6</version>
</dependency>
</dependencies>
</project