Solved: How to fix Exception in thread "main" java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError ?

Some of you might be experiencing below error while executing tests via TestNG:

[RemoteTestNG] detected TestNG version 7.0.1
Exception in thread "main" java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/google/inject/Stage
    at org.testng.internal.Configuration.<init>(Configuration.java:33)
    at org.testng.TestNG.init(TestNG.java:216)
    at org.testng.TestNG.<init>(TestNG.java:200)
    at org.testng.remote.AbstractRemoteTestNG.<init>(AbstractRemoteTestNG.java:17)
    at org.testng.remote.support.RemoteTestNG6_12.<init>(RemoteTestNG6_12.java:18)
    at org.testng.remote.support.RemoteTestNGFactory6_12.createRemoteTestNG(RemoteTestNGFactory6_12.java:16)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:67)
Caused by: java.lang.NoClassDefFoundError: com/google/inject/Stage

How to Fix?

Simply update TestNG version to 7.2.x. Fixed! That's it. Happy Testing :)

Comments