Mahbub Rahman Mahbub Rahman - 1 month ago 9
Java Question

How to fix NoClassDefFoundError: CircularOutputStream error?

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>


But it is getting error:

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


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

Thanks in advance.

Answer Source

At last I got the solution.

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();

instead of

driver = new PhantomJSDriver(caps);

generates the error.