TestNG 7.1.0
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
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
@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 ?
Doubtful. The dependency is harder now than it was before.
Note that the error is NoClassDefFound
, not ClassNotFound
. Guice is missing a dependency, it seems.
Making guice
compile time dependency seems to me as a wrong direction. And BTW, it's not backward compatible, so such a change should be in major version only.
It is api only though.
If the pom.xml
was generated as compile
, this looks like a bug in Gradle(?).
Well, maven (i.e. pom.xml
) doesn't have "api only" scope. It's needed for compilation and it's being exposed by api -> compile
scope.
BTW, what will happen, if I have guice
required in the project in different incompatible version? Is it backward compatible?
Guice is compile time dependency: https://github.com/cbeust/testng/blob/master/src/main/java/org/testng/internal/Configuration.java#L33
so it's hard dependency
the fix is either make Guice the compile dependency in pom manifest or make injectorFactory lazy init
please remove the jar file from the build path and install TestNG from help menu(install software)
worked for me
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.
please remove the jar file from the build path and install TestNG from help menu(install software)
worked for me
Can you please provide me the link to install plugin from "Install new software"
please remove the jar file from the build path and install TestNG from help menu(install software)
worked for meCan you please provide me the link to install plugin from "Install new software"
From Eclipse, Go to Help > Install software or You can install from market place as well (Help > Market Place). After installing TestNG from market place, it dint work, but installing the GUICE422.jar to the build path worked for me
So make sure after installing TestNG from market place, install the Guice422 Jar file as well
Eclipse IDE for Java Developers, Version: 2019-12 (4.14.0), Build id: 20191212-1212.
TestNG 7.1.0.r202001120626Removing 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.
That is the only way that works for me as well, and the weirdest thing was TestNG version 7.0.1 was displayed in the console regardless of the TestNG version that I installed was 7.1.1. Anyway it works now.
@krmahadevan We need this fix, when is the next release of TestNG?
@yaminikb - The release should be out soon (in a week or so).
JFI, my TestNG apparently has just updated, to 7.1.1.202003100345, but if I remove from the build path the Guice JAR that I had to add manually to avoid the NoClassDefFoundError, the error reappears.
So for me today's update made zero difference, besides the fact that now I can't tell for sure which TestNG version I have: expanding the TestNG node in Package Explorer says 7.1.0.r202001120626 (which is the same I already had since long before today's update), and under C:\eclipse\plugins, besides the 7.1.0.* JARs that I already had, I now also have two 7.1.1.* JARs which, as I mentioned, don't seem to be used.
But the bottom line is that for me this update did not affect the NoClassDefFoundError: the Guice JAR on the build path as an external JAR is still necessary for me.
The eclipse plugin update is not to fix this issue. Still need to wait for the new testng release .
How to downgrade to version 7.0.?
[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.
at org.testng.TestNG.init(TestNG.java:216)
at org.testng.TestNG.
at org.testng.remote.AbstractRemoteTestNG.
at org.testng.remote.support.RemoteTestNG6_12.
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
... 7 more
Caused by: java.lang.ClassNotFoundException: com.google.inject.Stage
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
I faced this issue kindly advice..
@mlook172 , you can try to install the beta build in your eclipse:
"Help -> Install New Software.. -> paste the below update site url into Work with:
field"
https://dl.bintray.com/testng-team/testng-p2/updatesites/7.2.0.b202003151750/
its working fine now
thanks
7.2.0.r202003151902 has fixed the issue, thank you!
thanks a lot
Works for me as well. Thanks !
I also faced the same issue. Thank you. It's working for me now
Eclipse IDE for Java Developers, Version: 2019-12 (4.14.0), Build id: 20191212-1212.
TestNG 7.1.0.r202001120626Removing 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.
It did excuse the error. But all the test cases are skipping/ failing on introducing guice.jar
@twinki1624 , could you try with my comment: https://github.com/cbeust/testng-eclipse/issues/472#issuecomment-599251156
@twinki1624 , could you try with my comment: cbeust/testng-eclipse#472 (comment)
Unfortunately, it's still now working.
Can you guide me through any other steps? I'm in the mid of a project, need it to be resolved at the earliest.
@twinki1624 , for this DTD https url issue, pls update testng eclipse plugin to latest update site: https://dl.bintray.com/testng-team/testng-eclipse-release
@twinki1624 , for this DTD https url issue, pls update testng eclipse plugin to latest update site: https://dl.bintray.com/testng-team/testng-eclipse-release
I tried it using the above link, help>install new software,it's not getting installed.
Any movement on this? I'm seeing the same issue.
Exception in thread "main" java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/google/inject/Stage
Any movement on this? I'm seeing the same issue.
Your version is probably not up to date, the problem was fixed with 7.2.0.r202003151902
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/
I'm also facing the same issue. I tried all the above solutions nothing worked for me
[RemoteTestNG] detected TestNG version 7.0.0
Exception in thread "main" java.lang.NoSuchMethodError: org.testng.TestNG.configure(Lorg/testng/CommandLineArgs;)V
at org.testng.remote.AbstractRemoteTestNG.configure(AbstractRemoteTestNG.java:75)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:235)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
I tried to match all the verion plugin and testng jar
For testNG p2- i used this urlhttps://dl.bintray.com/testng-team/testng-p2-release/7.0.0/
Can someone please help me here
It's not the same issue, you have a NoSuchMethodError, not a NoClassDefFoundError. Look up the causes of NoSuchMethodError. A JAR is found in your case but you probably have some version mismatch, maybe an old JAR.
As first thing I would uninstall TestNG and do a full reinstallation of the latest version, especially if you have been trying different workarounds.
@santibailors thanks for your reply.
I also, tried that, uninstalled the TestNG and reinstalled the latest version, it didnt work.
then again i uninstalled the latest version an installed TestNG7.0.0 just to maintain same versions for jar file and plugin.
Although I'm not sure if that should be the case,
I don't know how it didn't work so it's difficult to say much, but if you mean that you got the NoSuchMethodError even from a clean reinstallation I would be surprised. Anyway, based on what is known, if it was me I would install another Eclipse in a separate folder (it won't interfere with the existing Eclipse installation), making sure it's the latest Eclipse, then install TestNG there, via marketplace. If it still gives the NoSuchMethodError it would be really strange.
You could also try to uninstall TestNG, close Eclpise, delete from the plugins
subfolder of Eclipse all the JARs that start with org.testng
before reinstalling TestNG from marketplace.
Also note that from your stacktrace it's clear that that NoSuchMethodError has nothing to do with Guice or other external libraries, so you should really open a new issue, your problem is not linked with the one discussed in this thread. And maybe by giving a specific title to the new thread you can get more focused help.
I already tried everything on brand new stuff, but once again i will try the same thing, may be I'm missing some key thing.
Also, I copied my previous pom.xml file(dependencies only) in the new one, as it has many jars that are required in my project. may be that could be the reason too..
once again thank you @SantiBailors
Removed TestNG jar file from the build path and add the following dependency to the POM.
It worked for me.
@SantiBailors0 You saved my day after wasting 3-4 hrs to find the right answer. Adding a dependency of GUICE4.2.2 is working like charm. Thanks man
Most helpful comment
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.