Re: issue locating error in JSP/compiled Java web application



Damon Getsman wrote:
More information in this post...

Is there anything in this snippet of error log that can help me locate
my error? Like what line # in time***.jsp or index.jsp it's dying
on here?

Yes, though it's a little indirect.

Or maybe even something subtle that I'm missing like follow
around one of the myBean.intBean objects to locate the error in one of
these files?

I really dislike the way tomcat reports errors; I'm checking more into
Resin now.

The challenge for Tomcat error messages is that JSP files are first translated into much longer Java files. These files contain the Java code you wrote plus printing code to write all the HTML you had in your JSP file. If JSP didn't exist, you'd have written such code by hand (shorter and more readable, but similar in spirit). Then the computer-generated Java code is compiled into a runnable class file. When an error occurs, all Java knows about is the class file, which contains information about the Java source, but knows nothing about the original JSP.

But there is hope, and you usually don't have to look too many lines into the error stack. Scan for references to _jsp.java files -- these are the Java translations of your JSP files.


-Damon

Sep 17, 2008 1:49:02 PM org.apache.catalina.core.ApplicationDispatcher
invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:415)
at java.lang.Integer.parseInt(Integer.java:497)
at org.apache.jsp.timesheet_jsp._jspService(timesheet_jsp.java:862)

Integer is the built-in Java Integer class. There shouldn't be any bugs here, but it will break if passed bad data. Basically Java expected to see a number where something non-numeric appeared.

timesheet_jsp.java is the Java translation of timesheet_jsp. 862 is the line that broke. You'll find timesheet_jsp.java in the Tomcat work/Catalina/localhost/<your webapp name>/org/apache/jsp/ directory.

Open that file in your IDE and find line 862. There'll be a ton of code you don't recognize, but hopefully you also recognize a fragment that came from your JSP file, so you'll know what line in time***.jsp caused the problem.

Often there'll be just one JSP in the stack but in your case, scan further...


at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
374)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:
630)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:
535)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:
472)
at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:
968)
at
org.apache.jsp.index_jsp._jspx_meth_c_005fotherwise_005f0(index_jsp.java:
1521)
at
org.apache.jsp.index_jsp._jspx_meth_c_005fchoose_005f0(index_jsp.java:
1423)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:145)

The time***.jsp problem happened while processing a c:choose in your index.jsp. There are several lines (1521, 1423, 145) listed because of the nesting of function calls and/or exception handlers in the Java code, but again one of those lines should contain a fragment you recognize from the original index.jsp file.

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
374)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
844)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
447)
at java.lang.Thread.run(Thread.java:619)

-=-=-=-
ITRx http://www.itrx-nd.com/
Systems Administrator/Programmer
-=-=-=-
.