如何修复NoClassDefFoundError:CircularOutputStream错误? [英] How to fix NoClassDefFoundError: CircularOutputStream error?

查看:104
本文介绍了如何修复NoClassDefFoundError:CircularOutputStream错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚为Selenium WebDriver(又称Selenium 2)自动化测试创建了一个简单的maven项目,用于无头测试.我在pom.xml中添加了PhantomJS驱动程序依赖项,如下所示:

I was just creating a simple maven project for Selenium WebDriver(a.k.a. Selenium 2) automated test for headless testing. I added the PhantomJS driver dependency as follows with other dependencies in pom.xml:

<dependency>
    <groupId>com.github.detro</groupId>
    <artifactId>phantomjsdriver</artifactId>
    <version>1.2.0</version>
</dependency>

但是出现错误:

java.lang.NoClassDefFoundError: org/openqa/selenium/io/CircularOutputStream
at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:60)
at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:56)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at jp.co.skygate.home.HomePageLogin.setUp(HomePageLogin.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at

只需从pom.xml中删除PhantomJS依赖关系即可解决此问题,并且可以很好地执行. 有人可以帮我找到问题吗?

Just removing the PhantomJS dependency from the pom.xml solves the problem and it executes fine. Can someone help me find the problem?

谢谢.

推荐答案

最后我得到了解决方案.

At last I got the solution.

添加PhantomJS v.1.2.0会将selenium-remote-driver-2.53.0.jar替换为selenium-remote-driver-2.41.0.jar,因此会破坏所有内容. 现在使用V.2.41.0,

Adding PhantomJS v.1.2.0 replaces the selenium-remote-driver-2.53.0.jar with selenium-remote-driver-2.41.0.jar and hence breaks down everything. And now using V.2.41.0,

driver = new FirefoxDriver();

代替

driver = new PhantomJSDriver(caps);

产生错误.

这篇关于如何修复NoClassDefFoundError:CircularOutputStream错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆