How to solve: Exception in thread "main" java.lang.NoClassDefFoundError: io/restassured/RestAssured ?

Exception in thread "main" java.lang.NoClassDefFoundError: io/restassured/RestAssured

Just Change Scope : Test --> Compile for rest-assured artifact in POM.xml

Before:
    <!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>3.1.0</version>
            <scope>test</scope>
        </dependency>

After:
    <!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>3.1.0</version>
            <scope>compile</scope>
        </dependency>       
How to solve: Exception in thread "main" java.lang.NoClassDefFoundError: io/restassured/RestAssured ? How to solve: Exception in thread "main" java.lang.NoClassDefFoundError: io/restassured/RestAssured ? Reviewed by Ishan Dev Shukl on September 07, 2018 Rating: 5

5 comments:

  1. Thanks a lot .. It solved my problem..

    ReplyDelete
  2. I am facing same issue but i am not using POM.Can anyone please help me in this?

    ReplyDelete
    Replies
    1. Download and downgrade Rest-Assured Jar to version 3.1.0. Rebuild the project. It should get fixed.

      Delete
  3. this is error which is shown

    C:\Users\Daffolap-624\workspace\WapandaParallel1>java org.testng.TestNG -log 10 C:\Users\Daffolap-624\workspace\WapandaParallel1\testng.xml
    [TestNG] RUNNING: Suite: "Test" containing "1" Tests (config: C:\Users\Daffolap-624\workspace\WapandaParallel1\testng.xml)
    [TestNG] INVOKING CONFIGURATION: "Test" - @BeforeTest API_Automation.ApiOperationsTest.StartDriver()
    [TestNG] FAILED CONFIGURATION: "Test" - @BeforeTest API_Automation.ApiOperationsTest.StartDriver() finished in 13 ms
    [TestNG] java.lang.NoClassDefFoundError: io/restassured/RestAssured
    [TestNG] at API_Automation.ApiOperationsTest.StartDriver(ApiOperationsTest.java:36)
    [TestNG] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [TestNG] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    [TestNG] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    [TestNG] at java.lang.reflect.Method.invoke(Unknown Source)
    [TestNG] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
    [TestNG] at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
    [TestNG] at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
    [TestNG] at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
    [TestNG] at org.testng.TestRunner.beforeRun(TestRunner.java:626)
    [TestNG] at org.testng.TestRunner.run(TestRunner.java:594)
    [TestNG] at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
    [TestNG] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
    [TestNG] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
    [TestNG] at org.testng.SuiteRunner.run(SuiteRunner.java:289)
    [TestNG] at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    [TestNG] at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    [TestNG] at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
    [TestNG] at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
    [TestNG] at org.testng.TestNG.runSuites(TestNG.java:1144)
    [TestNG] at org.testng.TestNG.run(TestNG.java:1115)
    [TestNG] at org.testng.TestNG.privateMain(TestNG.java:1442)
    [TestNG] at org.testng.TestNG.main(TestNG.java:1411)
    [TestNG] Caused by: java.lang.ClassNotFoundException: io.restassured.RestAssured
    [TestNG] at java.net.URLClassLoader.findClass(Unknown Source)
    [TestNG] at java.lang.ClassLoader.loadClass(Unknown Source)
    [TestNG] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    [TestNG] at java.lang.ClassLoader.loadClass(Unknown Source)

    ReplyDelete

Thanks a lot for your valuable Comment!

Powered by Blogger.