anyone want to help me with JSP error?

MikeMike

Lifer
Feb 6, 2000
45,885
66
91
well i need some help with my JSP program for school, i am doing a login page, but its not working, i am not getting any specific error, or line, just the errors:

exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:346)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

root cause

java.lang.NullPointerException
org.apache.jsp.mbarnard.JSPLab06.login_jsp._jspService(login_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

now what would be causing that within my code? i dont want to post it on here if a teacher were to assume i was cheating or something this could possibly be considered it and i dont want to be a cheater.

aim: pball4evr

MIKE
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Your code is throwing an NPE. To see where you'll have to look at the "converted" jsp which tomcat has actually turned into a servlet.

From your toplevel tomcat installation directory this should be work/Catalina/localhost/appname/org/apache/jsp/mbarnard/JSPLab06

Open the file login_jsp.java and look at line 82 (or whatever line it happens to be if you're since changed your page). The code will be a little difficult to decipher but it will vaguely represent your page and should give you a clue as to what's going wrong.
 

MikeMike

Lifer
Feb 6, 2000
45,885
66
91
Originally posted by: kamper
Your code is throwing an NPE. To see where you'll have to look at the "converted" jsp which tomcat has actually turned into a servlet.

From your toplevel tomcat installation directory this should be work/Catalina/localhost/appname/org/apache/jsp/mbarnard/JSPLab06

Open the file login_jsp.java and look at line 82 (or whatever line it happens to be if you're since changed your page). The code will be a little difficult to decipher but it will vaguely represent your page and should give you a clue as to what's going wrong.

the problem is that the server i am on is not my own computer, its a general server that serves about 100 ppl on the campus for tomcat. (we crashed it the other day while taking the lab practical)

i guess ill install tomcat on here and run it, and then change my application.getRealPath to the right spot so i can figure out the issue

although i think the issue comes from this area of code

the code below is deffinately the issue. im just not sure what is wrong with it yet.

new code, the line with the issue is when i am trying to split the string at the comma (we are uing txt files) for some reason its not spliting or something, the txt file is fine.

 

znaps

Senior member
Jan 15, 2004
414
0
0
If you can't debug, the only thing to do is output a lot of System.out's to see what is null.
 

MikeMike

Lifer
Feb 6, 2000
45,885
66
91
Originally posted by: znaps
If you can't debug, the only thing to do is output a lot of System.out's to see what is null.

i installed tomcat so now i can look at the new code.

MIKE
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Originally posted by: znaps
If you can't debug, the only thing to do is output a lot of System.out's to see what is null.
There are much better solutions than sysouts for debugging web apps. Log4j, for instance.
 

MikeMike

Lifer
Feb 6, 2000
45,885
66
91
Originally posted by: kamper
Originally posted by: znaps
If you can't debug, the only thing to do is output a lot of System.out's to see what is null.
There are much better solutions than sysouts for debugging web apps. Log4j, for instance.

ok, how would i debug it by viewing the value? i need to see what it is getting for tempLine to see if its even getting anything, what would i type and where? ive never really had to use it like this, i have netbeans on my room computer, but i dont have internet for it (damn you resnet) so im on a lab computer and cant install it.

MIKE
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Whoops, sorry for not spotting that :( I had one of those in my first year that took a long time to find too...