You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2008/05/14 02:11:26 UTC
DO NOT REPLY [Bug 44756] Can'
t get a class name or stack trace for NoClassDefFoundError
https://issues.apache.org/bugzilla/show_bug.cgi?id=44756
Colm Smyth <la...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
--- Comment #1 from Colm Smyth <la...@gmail.com> 2008-05-13 17:11:25 PST ---
I agree it's not very obvious how to achieve this, but if you add an element
<formatter type="plain">
within your <junit> element, a text file will be created with the stack trace
of your test case.
I wrote a basic test class XXXTest (no package) that referred to a missing
class; the output went to a file TEST-XXXTest.txt as follows:
Testsuite: XXXTest
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
------------- Standard Error -----------------
This message went to syserr
------------- ---------------- ---------------
Caused an ERROR
YYYTest
java.lang.NoClassDefFoundError: YYYTest
at XXXTest.<clinit>(XXXTest.java:17)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
Caused by: java.lang.ClassNotFoundException: YYYTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Note the NoClassDefFoundError. If however you run it on a class that doesn't
exist (e.g. XXXTest1), you get a ClassNotFoundException:
Testsuite: XXXTest1
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
Caused an ERROR
XXXTest1
java.lang.ClassNotFoundException: XXXTest1
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
I hope this helps.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.