To tell you the truth, I don't get all this baloney we hear all the time
about error finding being such a problem with JSP, or Jasper, etc.  I really
have never had a problem with this.  If you spend three months coding before
you test something, I can see the problem.  But, that's silly.  If not, I
have absolutely no problem isolating the problem right away.  Error
reporting is not supposed to replace knowledge of the technology.


-----Original Message-----
From: Jeff Turner <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Monday, October 22, 2001 7:51 PM
Subject: Re: Catching NPE's in JSPs


>I don't know.. 3.2, 3.3 and 4.0 are all uniformly useless at JSP error
>reporting, probably because (AFAIK) they use variants of the same JSP
servlet,
>Jasper. Anyone know if other JSP engines handle errors better?
>
>Velocity people will rightly claim that this is the fundamental ickyness of
JSP
>showing though ;)
>
>http://jakarta.apache.org/velocity/ymtd/ymtd.html
>
>
>If you're on Unix and have vim installed, the following script might be of
use.
>
># Takes a filename:lineno string
>function tvim()
>{
>    [ -z "$1" ] && return
>    filename=`echo $1 | cut -d: -f 1`
>    lineno=`echo $1 | cut -d: -f 2`
>    echo "Searching for file $filename, line no $lineno"
>    path=`find $TC_HOME/work -name "$filename"`
>    if [ -e "$path" ]; then
>        vim "$path" +$lineno
>    else
>        echo "Couldn't find file $filename in $TC_HOME/work."
>    fi
>}
>
>
>When you see an error like:
>
>..
>Root cause:
>java.lang.NullPointerException
>        at foo_1._jspService(foo_1.java:59)
>        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
>
>Go to a terminal and type 'tvim foo_1.java:59'. The script will search for
the
>compiled .java file and open up vim at the right line number. Make sure you
>quote with 's to escape the $'s that Tomcat 4 uses.
>
>
>HTH,
>
>--Jeff
>
>On Mon, Oct 22, 2001 at 02:26:48PM -0700, Hunter Hillegas wrote:
>> Like a lot of people, sometimes I'll see a JSP error out with an NPE...
In
>> this case I have a JSP that pulls some stuff using request.getAttribute()
>> and displays the info...
>>
>> I'm having a hell of a time finding the current culprit of my NPE... I've
>> tried pulling out sections of code and reloading... Still having
trouble...
>> Tomcat4 seems to buffer slightly differently where with 3.x the NPE was
>> closer to the code that was just output?
>>
>> Anyway, wondering if anyone has any insightful methods to track down NPEs
in
>> JSPs...
>>
>> Hunter
>

Reply via email to