Runtime Errors
Resin 3.0

Features
Installation
Configuration
Web Applications
IOC/AOP
Resources
JSP
Servlets and Filters
Portlets
Databases
Admin (JMX)
CMP
EJB
Amber
EJB 3.0
Security
XML and XSLT
XTP
JMS
Performance
Protocols
Third-party
Troubleshooting/FAQ

Introduction
JSP Compilation
Reference
Tutorials
Articles
FAQ

JSP Page Creation
Request
Topics
Tag Libraries

JSP
parse error messages
runtime error messages
parse error messages
JSP Page Creation
Request

Runtime Errors

When the Java code throws an exception, Resin will immediately stop the script and report the error to the browser. For example, we'll force a null pointer exception:

buggy.jsp
<%@ page language=java %>

<% String foo = null; %>
<%= foo.length() %>

The reported error looks something like the following:

500 Servlet Exception

java.lang.NullPointerException
  at work.test.buggy$_jsp._jspService(/test/buggy.jsp:4)
  at com.caucho.jsp.JavaPage.service(JavaPage.java:72)
  at com.caucho.jsp.QServlet.service(QServlet.java:152)
  at com.caucho.server.http.Invocation.service(Invocation.java:183)
  at com.caucho.server.http.Request.dispatch(Request.java:174)
  at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:151)
  at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:114)
  at com.caucho.server.TcpConnection.run(TcpConnection.java:115)
  at java.lang.Thread.run(Thread.java)

The most important part of the error message is the location: `/test/buggy.jsp:4'. Resin translates the line in the generated Java code back to the JSP line.

What if I get 'Compiled Code' instead of lines?

You should run Resin with -nojit, turning off the just-in-time compiler, when developing so you can see the proper line numbers. That alone will make development much easier.

Java VMs with just-in-time compilers (jits) compile Java bytecodes to machine code. This makes Java almost as fast as C, but removes all the line numbers. Running with -nojit will disable the compiler. When your code is completely debugged, you can run with the compiler enabled.

To see the difference, here's the same stack trace with a JIT enabled:

500 Servlet Exception

java.lang.NullPointerException
 at work.test.buggy$_jsp._jspService(Compiled Code)
 at com.caucho.jsp.JavaPage.service(Compiled Code)
 at com.caucho.jsp.QServlet.service(Compiled Code)
 at com.caucho.server.http.Invocation.service(Compiled Code)
 at com.caucho.server.http.Request.dispatch(Compiled Code)
 at com.caucho.server.http.HttpRequest.handleRequest(Compiled Code)
 at com.caucho.server.http.HttpRequest.handleConnection(Compiled Code)
 at com.caucho.server.TcpConnection.run(Compiled Code)
 at java.lang.Thread.run(Compiled Code)


parse error messages
JSP Page Creation
Request
Copyright © 1998-2005 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.