ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 44756] Can' t get a class name or stack trace for NoClassDefFoundError
Date Wed, 14 May 2008 00:11:26 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=44756


Colm Smyth <lateralcoder@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




--- Comment #1 from Colm Smyth <lateralcoder@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.

Mime
View raw message