Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting java.lang.NoClassDefFoundError: org/apache/http/client/RedirectStrategy error #361

Closed
lokeshkp opened this issue Mar 24, 2018 · 7 comments
Labels

Comments

@lokeshkp
Copy link

lokeshkp commented Mar 24, 2018

Hi I am new to this tool try to learn and write simple web service test program as follows,

test.feature contains as below

Feature: Test User API Using Karate Framework
Scenario: Fetch all users
Given url 'http://services.groupkt.com/state/get/IND/all'
When method GET
Then status 200

KarateTestDemo.java contains as below

import com.intuit.karate.testng.KarateRunner;
public class KatateTest extends KarateRunner{

}

OS: Windows10:
Java version: 1.8
IDE: Eclipse with cucumber plugin
both runner and feature files are in same package.
all required dependencies included in pom file but when I am running getting below error,

FAILED: feature(Test User API Using Karate Framework)
Runs Cucumber Feature
java.lang.NoClassDefFoundError: org/apache/http/client/RedirectStrategy
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intuit.karate.http.HttpClient.construct(HttpClient.java:231)
at com.intuit.karate.http.HttpClient.construct(HttpClient.java:256)
at com.intuit.karate.ScriptContext.(ScriptContext.java:131)
at com.intuit.karate.StepDefs.(StepDefs.java:78)
at com.intuit.karate.cucumber.KarateObjectFactory.getInstance(KarateObjectFactory.java:80)
at com.intuit.karate.cucumber.KarateObjectFactory.getStepDefs(KarateObjectFactory.java:87)
at com.intuit.karate.cucumber.KarateBackend.getStepDefs(KarateBackend.java:104)
at com.intuit.karate.cucumber.KarateBackend.getVars(KarateBackend.java:81)
at com.intuit.karate.cucumber.KarateBackend.beforeStep(KarateBackend.java:85)
at com.intuit.karate.cucumber.CucumberUtils.runStep(CucumberUtils.java:226)
at com.intuit.karate.cucumber.KarateRuntime.runStep(KarateRuntime.java:80)
at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
at com.intuit.karate.testng.KarateRunner.feature(KarateRunner.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Appreciate if any one help on this.

@ptrthomas
Copy link
Member

duplicate of #360 please read it

@lokeshkp
Copy link
Author

As you suggest created new project still issue remains the same.

@ptrthomas
Copy link
Member

@lokeshkp unless you provide a FULL working example to replicate this, no one can help you.

From experience I am pretty sure you have a pom that has the wrong mix of dependencies. no one else has reported this issue.

@lokeshkp
Copy link
Author

lokeshkp commented Mar 25, 2018

Thanks thomas for reply no I didn't used mix of dependencies please have a look,

<dependency>
    <groupId>com.intuit.karate</groupId>
    <artifactId>karate-testng</artifactId>
    <version>0.7.0</version>
</dependency>


<dependency>
    <groupId>com.intuit.karate</groupId>
    <artifactId>karate-core</artifactId>
    <version>0.7.0</version>
</dependency>

<dependency>
    <groupId>com.intuit.karate</groupId>
    <artifactId>karate-apache</artifactId>
    <version>0.7.0</version>
    <scope>test</scope>
</dependency>

@lokeshkp
Copy link
Author

@ptrthomas also I tried by down graded to version 0.6.2.3 but no luck

@ptrthomas
Copy link
Member

@lokeshkp sorry, this is not a full working example.

@ptrthomas
Copy link
Member

@lokeshkp here is how you can submit an issue with your problem: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants