caucho
Resin
FAQ
Reference Guide
Demo
Tutorial

JSP page
Config
URLs
Database Forms
XTP Copy
Hello Tag
Vary Filter
HardCore
Mailing Forms
Beans
Cache
XSL Filter
run-at

Servlet
Parse Errors
Runtime Errors
Debugging
 Runtime Errors

Parse Errors
JSP page
Debugging

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 Errors
JSP page
Debugging
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.