Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError in TestNGClassFinder.<init> #602

Closed
aanno opened this issue Feb 5, 2015 · 2 comments
Closed

NoClassDefFoundError in TestNGClassFinder.<init> #602

aanno opened this issue Feb 5, 2015 · 2 comments

Comments

@aanno
Copy link
Contributor

aanno commented Feb 5, 2015

With TestNG 6.8.21, I've got this mysterious error when I try to use the test from a maven run triggered with:

mvn cobertura:cobertura -Dcobertura.report.format=xml


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project nuclos-client: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: There was an error in the forked process
[ERROR] java.lang.NoClassDefFoundError: org/eclipse/jgit/api/errors/GitAPIException
[ERROR] at java.lang.Class.getDeclaredMethods0(Native Method)
[ERROR] at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
[ERROR] at java.lang.Class.privateGetPublicMethods(Class.java:2733)
[ERROR] at java.lang.Class.getMethods(Class.java:1472)
[ERROR] at org.testng.internal.TestNGClassFinder.(TestNGClassFinder.java:59)
[ERROR] at org.testng.TestRunner.initMethods(TestRunner.java:409)
[ERROR] at org.testng.TestRunner.init(TestRunner.java:235)
[ERROR] at org.testng.TestRunner.init(TestRunner.java:205)
[ERROR] at org.testng.TestRunner.(TestRunner.java:153)
[ERROR] at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:536)
[ERROR] at org.testng.SuiteRunner.init(SuiteRunner.java:159)
[ERROR] at org.testng.SuiteRunner.(SuiteRunner.java:113)
[ERROR] at org.testng.TestNG.createSuiteRunner(TestNG.java:1299)
[ERROR] at org.testng.TestNG.createSuiteRunners(TestNG.java:1286)
[ERROR] at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
[ERROR] at org.testng.TestNG.run(TestNG.java:1057)
[ERROR] at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:295)
[ERROR] at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84)
[ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:90)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
[ERROR] Caused by: java.lang.ClassNotFoundException: org.eclipse.jgit.api.errors.GitAPIException
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[ERROR] ... 22 more

Even if I'm doing something nasty here, my feeling is that TestNG should recover for problem (and behave more gracefully): I don't want to do anything with org/eclipse/jgit/api/errors/GitAPIException (i.e. I'm not going to test it nor am I aware of that my tests have a dependency on this class).

In java NoClassDefFoundError is thrown when the classpath is not complete (i.e. GitAPIException is found, but it dependencies are not, it's a LinkageError). When scanning for tests, TestNG should simply emit a warning if a NoClassDefFoundError occurs, there is no need to bail out.

@cbeust
Copy link
Collaborator

cbeust commented Feb 5, 2015

Agreed, TestNG should catch this exception and exit more gracefully.

cbeust added a commit that referenced this issue Apr 24, 2015
@juherr
Copy link
Member

juherr commented Apr 24, 2015

Issue closed by #603

@cbeust cbeust closed this as completed Apr 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants