testng: testng 7.1.0 java.lang.ClassNotFoundException: com.google.inject.Stage

TestNG Version

TestNG 7.1.0

Expected behavior

Actual behavior

the testng-remote integration test failed https://travis-ci.org/testng-team/testng-remote/jobs/481901771

[RemoteTestNG] revisions:
	git.commit.id=32c8977
	git.branch=32c8977911e409c8c8c2d4bce973e94d2acf5ca7
	git.build.version=1.4.1-SNAPSHOT
[RemoteTestNG] loaded class org.testng.internal.Version at file:/home/travis/.groovy/grapes/org.testng/testng/jars/testng-7.1.0.jar
[RemoteTestNG] detected TestNG version 7.1.0
Caught: java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/google/inject/Stage
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)
	at org.testng.remote.RemoteTestNG$main.call(Unknown Source)
	at TestNGTest.run(TestNGTest.groovy:49)
Caused by: java.lang.NoClassDefFoundError: com/google/inject/Stage
	... 9 more
Caused by: java.lang.ClassNotFoundException: com.google.inject.Stage
	... 9 more
[BaseMessageSender] Stopped receiver

Is the issue reproductible on runner?

  • Shell
  • Maven
  • Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans

Test case sample

Please, share the test case (as small as possible) which shows the issue https://github.com/testng-team/testng-remote/blob/master/remote-test/src/test/groovy/Tester.groovy

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 38 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Eclipse IDE for Java Developers, Version: 2019-12 (4.14.0), Build id: 20191212-1212. TestNG 7.1.0.r202001120626

Removing the TestNG library from the build path of the project containing the test and installing TestNG from menu Help / Install New Software did not work for me, I kept getting this error.

What worked for me was downloading guice-4.2.2.jar (from https://github.com/google/guice/wiki/Guice422), copying it into any folder, and adding it to the build path of the project as external JAR.

@missedone

In 7.0.0 pom below was the dependency information on guice

<dependency>
    <groupId>com.google.inject</groupId>
    <artifactId>guice</artifactId>
    <version>4.1.0</version>
    <classifier>no_aop</classifier>
    <scope>provided</scope>
</dependency>

In 7.1.0 pom below was the dependency information on guice

<dependency>
    <groupId>com.google.inject</groupId>
    <artifactId>guice</artifactId>
    <version>4.1.0</version>
    <classifier>no_aop</classifier>
    <scope>compile</scope>
</dependency>

So perhaps this issue is because guice became a compile time dependency from being a provided dependency ?

Install TestNG 7.1 and then install P2 libraries from TestNG 7.2 “Help -> Install New Software… -> paste the below url Work with: field” https://dl.bintray.com/testng-team/testng-eclipse-release/ Eclipse is restarted, then again: "Help -> Install New Software… -> https://dl.bintray.com/testng-team/testng-p2-release/

The eclipse plugin update is not to fix this issue. Still need to wait for the new testng release .