Getting error "ClassNotFoundException" even after scribe for oauth in restassured

1.3k Views Asked by At

Added Scribe in pom file which is used for oauth in restassured as per the documenation, Even then getting the error

java.lang.ClassNotFoundException:com.github.scribejava.core.model.AbstractRequest

How to resolve this error. Added below dependency of scribe in pom file

<dependency>
        <groupId>com.github.scribejava</groupId>
        <artifactId>scribejava-apis</artifactId>
        <version>5.5.0</version>
        <scope>test</scope>
</dependency>

Below mentioned the code written to make the request.

 Response response  = given().auth().
                         oauth("c", "r", "3", "r1").
                         post("https://api.twitter.com/1.1/statuses/home_timeline.json").
                         then().
                         assertThat().
                         statusCode(200).
                         log().all().extract().response();
2

There are 2 best solutions below

0
cassiomolin On

Have a look at the javadocs: AbstractRequest was deprecated in ScribeJava 4.0.0 and it was removed in the version 4.1.0. So it longer exists in ScribeJava 5.5.0 and OAuthRequest must be used instead.

0
sweta kumari On

I was also getting the same error message then i changed the version of ScribeJava 4.0.0 to scribejava-apis 2.5.3 and scribejava-core 2.5.3 It worked for me.