Re: How to resolve " java.lang.NoClassDefFoundError: org/apache/http/auth/Credentials" ERROR

13,133 views
Skip to first unread message

Robert

unread,
Jun 1, 2013, 7:57:24 PM6/1/13
to webd...@googlegroups.com
Please share the complete content of your pom file

On Friday, May 31, 2013 1:50:58 PM UTC-7, Isaac Mova wrote:
Hello,

I am using  webdriver  with cucumber JVM on IDEA,  getting following error while trying to start Firefox from script. I am not sure  if i have missed any jars in classpath..this seems to be a generic error. The jar i included is "Selenium-java-2.32.0'..

any ideas on this issue?



java.lang.NoClassDefFoundError: org/apache/http/auth/Credentials
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:81)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
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:92)
at Demo.abc(Demo.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at cucumber.runtime.Utils$1.call(Utils.java:42)
at cucumber.runtime.Timeout.timeout(Timeout.java:12)
at cucumber.runtime.Utils.invoke(Utils.java:38)
at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:59)
at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:192)
at cucumber.runtime.Runtime.runHooks(Runtime.java:184)
at cucumber.runtime.Runtime.runBeforeHooks(Runtime.java:175)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:32)
at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:76)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:65)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:20)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:72)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:77)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at cucumber.api.junit.Cucumber.run(Cucumber.java:82)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.ClassNotFoundException: org.apache.http.auth.Credentials
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)
... 48 more

darrell

unread,
Jun 1, 2013, 9:36:00 PM6/1/13
to webd...@googlegroups.com
If you are including the jar files yourself (not using a repository to add the files to your project) then have a look at the zip file. There will be a selenium-java-2.32.0.zip file (name might be slightly different). This zip file will contain the java bindings, the src for the java binds and a lib directory. All the jars in the lib directory need to be added to your classpath as well.

Isaac Mova

unread,
Jun 2, 2013, 4:07:12 PM6/2/13
to webd...@googlegroups.com
Here is the Pom file:

<?xml version="1.0" encoding="UTF-8"?>
    <modelVersion>4.0.0</modelVersion>

    <groupId>WebDriverwithCukesjvm</groupId>
    <artifactId>WebDriverwithCukesjvm</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.1.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <version>1.1.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.1.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.33.0</version>
        </dependency>
    </dependencies>


</project>

Nareshkumar.prathipati

unread,
Jun 2, 2013, 8:40:27 PM6/2/13
to webd...@googlegroups.com
What version of Firefox ?

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Isaac Mova

unread,
Jun 3, 2013, 4:05:47 AM6/3/13
to webd...@googlegroups.com
Firefox 19.0

Mark Collin

unread,
Jun 3, 2013, 5:06:17 AM6/3/13
to webd...@googlegroups.com
try changing your dependency from

selenium-java

to

selenium-server

Robert

unread,
Jun 3, 2013, 4:39:58 PM6/3/13
to webd...@googlegroups.com
Issac,

If memory serves me, I think I ran into a similar issue.  It turned out to be a bug in Selenium.  The solution was to add the following dependency to my pom file

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
</dependency>

See if that helps.

Isaac Mova

unread,
Jun 4, 2013, 4:09:26 PM6/4/13
to webd...@googlegroups.com
Robert,

Thanks for the information,

httpclient 4.2.2 is working.

Balaji K

unread,
Jul 19, 2017, 9:05:40 PM7/19/17
to webdriver
I am getting this error while executing my appium script in Intellij

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/internal/HasIdentity
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:41)
at conquest.login.main(login.java:28)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.internal.HasIdentity
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 26 more

Let me know the solution for this
Reply all
Reply to author
Forward
0 new messages