Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.copyInputStreamToFile(Ljava/io/InputStream;Ljava/io/File;)

While trying to launch firefox browser using selenium

Function:

     System.setProperty("webdriver.gecko.driver", Constants.PROJECT_PATH+Constants.MARIONETTE_FIREFOX);
     log.info("Marionette file path: "+Constants.PROJECT_PATH+Constants.MARIONETTE_FIREFOX);
     MarionetteDriverManager.getInstance().setup();

In the 3rd line i am getting the mentioned error message -

"java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.copyInputStreamToFile(Ljava/io/InputStream;Ljava/io/File;)"

Maven Dependency tags I am using is

   <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>

New dependecy tags added following #Christian Lutz answer

    <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.5</version>
    </dependency>

How can I re-solve the issue?

like image 946
Madhavi Mokkapati Avatar asked Dec 23 '22 18:12

Madhavi Mokkapati


1 Answers

In version 1.3.2 the class FileUtilsdoesn't have a method copyInputStreamToFile you need at least version 2.0

Please see the javadoc for the current version 2.5. There you will find the method and a Sincetag.

like image 86
Christian Avatar answered Jan 18 '23 23:01

Christian