You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Erik Meade <em...@geekfarm.org> on 2000/05/31 01:47:58 UTC

JIT Nullpointer masking NoClassDefError

I was cleaning up my classpath ( i.e. setting it over :)), and noticed
that if you don't have the SAX parser.jar in your class path you
get NullPointerException instead of a NoClassDefFoundError.

Just felt like sharing....
Erik Meade


D:\Java\jakarta\jakarta-ant>echo %CLASSPATH%
D:\Java\jdk1.2.2\lib\tools.jar;D:\Java\jakarta\jakarta-ant\lib\ant.jar;D:\Java\lib\jaxp.jar

D:\Java\jakarta\jakarta-ant>ant
Buildfile: build.xml
Exception in thread "main" java.lang.NullPointerException
         at org.apache.tools.ant.Main.runBuild(Main.java, Compiled Code)
         at org.apache.tools.ant.Main.main(Main.java, Compiled Code)

D:\Java\jakarta\jakarta-ant>ant
Warning: JIT compiler "none" not found. Will use interpreter.
Buildfile: build.xml
Exception in thread "main" java.lang.NoClassDefFoundError: 
org/xml/sax/SAXException
         at org.apache.tools.ant.Main.runBuild(Main.java:223)
         at org.apache.tools.ant.Main.main(Main.java:190)


Re: [PATCH] Catch some more exceptions when JAXP is not present

Posted by Erik Meade <em...@geekfarm.org>.
Stefan,

Your patch does the trick.

Erik Meade

At 02:55 PM 5/31/2000 +0200, you wrote:
> >>>>> "EM" == Erik Meade <em...@geekfarm.org> writes:
>
>  EM> I was cleaning up my classpath ( i.e. setting it over :)), and
>  EM> noticed that if you don't have the SAX parser.jar in your class
>  EM> path you get NullPointerException instead of a
>  EM> NoClassDefFoundError.
>
>This seems to depend on the JDK, on Linux (Blackdown's 1.2.2RC4) I get
>the NoClassDefFoundError in either case - but this one remains
>uncaught.
>
>The appended patch catches the NoClassDefFoundError as well as
>NullPointerException and emits a more meaningful error message. BTW
>the NoClassDefFoundError results from the ClassLoader loading
>ProjectHelper not from the Class.forName in the try block.
>
>I had to patch BuildException to accept Errors as well as Exceptions
>as cause.
>
>Stefan
>


[PATCH] Catch some more exceptions when JAXP is not present

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "EM" == Erik Meade <em...@geekfarm.org> writes:

 EM> I was cleaning up my classpath ( i.e. setting it over :)), and
 EM> noticed that if you don't have the SAX parser.jar in your class
 EM> path you get NullPointerException instead of a
 EM> NoClassDefFoundError.

This seems to depend on the JDK, on Linux (Blackdown's 1.2.2RC4) I get
the NoClassDefFoundError in either case - but this one remains
uncaught.

The appended patch catches the NoClassDefFoundError as well as
NullPointerException and emits a more meaningful error message. BTW
the NoClassDefFoundError results from the ClassLoader loading
ProjectHelper not from the Class.forName in the try block.

I had to patch BuildException to accept Errors as well as Exceptions
as cause.

Stefan