(With apologies to readers who don't give a flying #'%^ about J2EE programming. That'll be most of you, probably)
A general principle: If (when) I run into an IT problem, Google can't help me find a fix, and I subsequently find a fix on my own: write it up and publish it somewhere search engines will find it, to help the next poor schmuck
Problem:
Jasper (
tomcat's JSP compiler) goes boom with the exceptionally-cryptic (compared to its normal error messages) stack
trace:
java.lang.ArrayIndexOutOfBoundsException: 8064
at org.apache.jasper.compiler.JspReader.peekChar(JspReader.java:154)
at org.apache.jasper.compiler.JspReader.skipUntil(JspReader.java:279)
at org.apache.jasper.compiler.ParserController.getPageEncodingForJspSyntax(ParserController.java:415)
at org.apache.jasper.compiler.ParserController.determineSyntaxAndEncoding(ParserController.java:386)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:170)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
at org.apache.jasper.JspC.processFile(JspC.java:727)
What to do about it:
Jasper is barfing on a bad tag.
This is a known (and fixed) bug in Jasper (see
bug 29866 for the gory details)
The problem is a bad JSP file, with an un-terminated xml/html/jsp tag at the end of the file. For example:
a bad file
Note the missing ">" at the end. To cause the problem, the broken tag has to be right at the end, without even a newline after it.
Google and
Apache.org's bugzilla got me that far. However, in practice, you probably have a zillion JSP files in place, and don't want to trawl the lot looking for a single typo. Worry not, there's a clue in the error message:
java.lang.ArrayIndexOutOfBoundsException: 8064
That number at the end is the exact size of the bad file, in bytes. Some cunning command-line use of dir or ls should help you find the culprit...