blufive: (Default)

(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:

<p>
  a bad file
</p

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...

Profile

blufive: (Default)
blufive

April 2017

S M T W T F S
      1
234 5678
9101112131415
16171819202122
23242526272829
30      

Syndicate

RSS Atom

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated 2017-07-25 00:45
Powered by Dreamwidth Studios