Upgrade to 2.28.0 results in NoClassDefFoundError

218 views
Skip to first unread message

Justin Gourley

unread,
Dec 18, 2012, 1:11:35 PM12/18/12
to seleniu...@googlegroups.com
Upgrading from 2.26 to 2.27 or 2.28 is causing my Java WebDriver tests to fail immediately upon browser open.

Firefox 16.0.1 on Linux.

Any suggestions on what may be causing this to happen? Error below.

java.lang.NoClassDefFoundError: org/apache/http/entity/ContentType
    at org.openqa.selenium.remote.HttpCommandExecutor$EntityWithEncoding.<init>(HttpCommandExecutor.java:420)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:315)
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:133)
    at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:355)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:506)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:188)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:183)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:179)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:96)
    at com.infusion.test.selenium2.WebDriverBase.initWebDriver(WebDriverBase.java:108)
    at com.infusion.test.selenium2.opportunity.OpportunityWebDriverTest.begin(OpportunityWebDriverTest.java:19)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:525)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:613)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.runWorkers(TestRunner.java:1178)
    at org.testng.TestRunner.privateRun(TestRunner.java:757)
    at org.testng.TestRunner.run(TestRunner.java:608)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)
    at org.testng.TestNG.run(TestNG.java:999)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:203)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)
    at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:111)
Caused by: java.lang.ClassNotFoundException: org.apache.http.entity.ContentType
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)



Shawn McCarthy

unread,
Dec 18, 2012, 1:43:35 PM12/18/12
to seleniu...@googlegroups.com
Which version of httpcore do you have in your dependencies ? I added:

<dependency>

<groupId>org.apache.httpcomponents</groupId>

<artifactId>httpcore</artifactId>

<version>4.2.2</version>

</dependency>


to my pom.xml and that fixed the issue for me.

Justin Gourley

unread,
Dec 18, 2012, 1:47:46 PM12/18/12
to seleniu...@googlegroups.com
Searching for this issue led me to another posted question where the answer to the problem was the lack of having Apache HttpCore library. I was under the impression that having this dependency in my pom file would have covered that. Can anyone verify any of the above?

<dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
                <version>${selenium.version}</version>
            </dependency>

            <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-api</artifactId>
                <version>${selenium.version}</version>
            </dependency>

Justin Gourley

unread,
Dec 18, 2012, 1:56:28 PM12/18/12
to seleniu...@googlegroups.com
I appreciate the reply Shawn!

Adding 4.2.1 to my dependencies has fixed the problem. Guess my assumption that the selenium-java dependency would cover this was wrong :(
Reply all
Reply to author
Forward
0 new messages