question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

23reactions
SantiBailors0commented, Feb 27, 2020

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.

6reactions
krmahadevancommented, Jan 12, 2020

@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 ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TestNG 7.0.1 java.lang.ClassNotFoundException
[RemoteTestNG] detected TestNG version 7.0.1. Exception in thread "main" java.lang.NoClassDefFoundError: com/google/inject/Stage at org.testng.internal.
Read more >
Exception in thread "main" java.lang.NoClassDefFoundError ...
Below is my stacktrace. Exception in thread "main" java.lang.NoClassDefFoundError: com/google/inject/Stage at org.testng.internal.
Read more >
I have downloaded TestNG VERSION 7.0 AND WHEN i run as ...
I have downloaded TestNG VERSION 7.0 AND WHEN i run as testng i haven;t wrote any ... NoClassDefFoundError: com/google/inject/Stage".
Read more >
How To Solve- org.testng.TestNGException - YouTube
Many people are facing issue because of the TestNG version and its compatibility issues. Here is the error log looks likeorg. testng.
Read more >
#eclipse #test Exception in thread "main" java.lang ... - YouTube
lang. NoClassDefFoundError : com/google / inject / Stage.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found