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

java.lang.NoClassDefFoundError: Could not initialize class io.restassured.RestAssured #4

Open
nshiveg opened this issue Jan 3, 2019 · 5 comments

Comments

@nshiveg
Copy link

nshiveg commented Jan 3, 2019

Hi John,

I am getting the below issue and I have tried all the options available. But unable to get it solved.
Please take a look into it and provide the solution. I have attached my POM here.

I am using the latest serenity 2.0.29.

16:08:31.213 [main] DEBUG c.n.a.rest.controller.RestBase - AutomationHome Path =C:\Users\nishiveg\GitWorkSpace\Final Checkin\AppAutomationServer
16:08:31.218 [main] DEBUG c.n.a.rest.controller.RestBase - Depolyment is impact less
16:08:32.281 [main] WARN net.thucydides.core.pages.Pages - Failed to instantiate page of type class com.nokia.automation.ui.isa.pageobject.AddCameraPage ({})
java.lang.NoClassDefFoundError: Could not initialize class io.restassured.RestAssured
at io.restassured.builder.RequestSpecBuilder.(RequestSpecBuilder.java:79)
at com.nokia.automation.rest.isa.rest.controller.IsaApiResponse.(IsaApiResponse.java:63)
at com.nokia.automation.ui.isa.pageobject.AddCameraPage.(AddCameraPage.java:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

pom.zip

@wakaleo
Copy link
Member

wakaleo commented Jan 3, 2019

Most likely the wrong version of RestAssured is being used. Do a dependency analysis or print the effective pom to see what version is being used; it needs to be the one used by your Serenity version.

@nshiveg
Copy link
Author

nshiveg commented Jan 3, 2019

Hi John,

We are upgrading the versions from serenity 1.2.2 to 2.0.29 and rest assured we were using 2.4.1.
Now I have removed the rest assured as an external dependencies. We are completely using serenity-rest which is 3.1.1.

And in the effective POM and mvn dependency:tree also I can see only one rest is present, which is serenity rest.

Please help me in this regard.

@wakaleo
Copy link
Member

wakaleo commented Jan 3, 2019

From memory, Serenity uses RestAssured 3.0.5. "java.lang.NoClassDefFoundError: Could not initialize class io.restassured.RestAssured" indicates a class version conflict. Without working with your project directly, it is hard to say more.

@GANESH0080
Copy link

I am also facing same issue. Can someone help on this ?

@arangrej
Copy link

arangrej commented Sep 24, 2021

Following dependencies resolved my problem. Use consistent versions might help. I was using different versions for these 3 dependencies.

    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>4.3.1</version>
    </dependency>
    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>rest-assured-common</artifactId>
        <version>4.3.1</version>
    </dependency>
    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>json-path</artifactId>
        <version>4.3.1</version>
    </dependency>

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

No branches or pull requests

4 participants