java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.copyInputStreamToFile(Ljava/io/InputStream;Ljava/io/File;)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43463648/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.copyInputStreamToFile(Ljava/io/InputStream;Ljava/io/File;)
提问by Madhavi Mokkapati
While trying to launch firefox browser using selenium
尝试使用 selenium 启动 firefox 浏览器时
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 -
在第 3 行中,我收到了提到的错误消息 -
"java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.copyInputStreamToFile(Ljava/io/InputStream;Ljava/io/File;)"
Maven Dependency tags I am using is
我使用的 Maven 依赖标签是
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
New dependecy tags added following #Christian Lutz answer
在#Christian Lutz 回答之后添加了新的依赖标签
<!-- 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?
我怎样才能重新解决这个问题?
回答by Christian
In version 1.3.2 the class FileUtils
doesn't have a method copyInputStreamToFile
you need at least version 2.0
在 1.3.2 版中,该类FileUtils
没有copyInputStreamToFile
您至少需要版本的方法2.0
Please seethe javadoc for the current version 2.5
. There you will find the method and a Since
tag.
请参阅当前版本的 javadoc 2.5
。在那里你会找到方法和一个Since
标签。
回答by amine
I'am using Websphere 8.5.5.14 , in my case i resolve the issue by adding the commons-io-2.2.jar as shared librarie .
我正在使用 Websphere 8.5.5.14 ,就我而言,我通过将 commons-io-2.2.jar 添加为共享库来解决该问题。