Mahbub Rahman Mahbub Rahman - 6 months ago 42
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:


But it is getting error:

java.lang.NoClassDefFoundError: org/openqa/selenium/io/CircularOutputStream
at org.openqa.selenium.firefox.FirefoxBinary.<init>(
at org.openqa.selenium.firefox.FirefoxBinary.<init>(
at org.openqa.selenium.firefox.FirefoxDriver.<init>(
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)

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download