Summary: | Invalid TLDs receive cryptic error | ||
---|---|---|---|
Product: | Tomcat 5 | Reporter: | Adam Winer <awiner> |
Component: | Jasper | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | Michiel.Meeuwissen |
Priority: | P3 | ||
Version: | Nightly Build | ||
Target Milestone: | --- | ||
Hardware: | Macintosh | ||
OS: | Mac OS X 10.4 |
Description
Adam Winer
2006-03-08 18:33:00 UTC
So where did you get the useful error text from? I rebuilt a version of Tomcat and added a printStackTrace() to at least see the buried message. Where did you add that printStackTrace call? I don't remember, to be honest - this was three months ago. I'd guess DefaultErrorHandler.jspError(), but that's just a guess. I think this bug may be fixed in tomcat 6. I get helpful messages like: org.apache.jasper.JasperException: File "/META-INF/tags/mm/u/option.tagx" not found I had a very similar problem in Tomcat 6.0.13 that was caused by a missing tld file in my deployment. The stacktrace was the same as in the first comment and did not indicate which tag library caused the problem. I used the following patch to track down the problem and log the cause of the exception: Index: java/org/apache/jasper/compiler/JspDocumentParser.java =================================================================== --- java/org/apache/jasper/compiler/JspDocumentParser.java (revision 563257) +++ java/org/apache/jasper/compiler/JspDocumentParser.java (working copy) @@ -214,7 +214,8 @@ jspDocParser.err.jspError (new Mark(jspDocParser.ctxt, path, e.getLineNumber(), e.getColumnNumber()), - e.getMessage()); + e.getMessage(), + e); } catch (Exception e) { jspDocParser.err.jspError(e); } Index: java/org/apache/jasper/compiler/ErrorDispatcher.java =================================================================== --- java/org/apache/jasper/compiler/ErrorDispatcher.java (revision 563257) +++ java/org/apache/jasper/compiler/ErrorDispatcher.java (working copy) @@ -225,6 +225,22 @@ * resource bundle for localized error messages, it is used as the error * message. * + * @param where Error location + * @param errCode Error code + * @param exception Exception + */ + + public void jspError(Mark where, String errCode, Exception exception) + throws JasperException { + dispatch(where, errCode, null, exception); + } + /* + * Dispatches the given JSP parse error to the configured error handler. + * + * The given error code is localized. If it is not found in the + * resource bundle for localized error messages, it is used as the error + * message. + * * @param n Node that caused the error * @param errCode Error code * @param arg1 First argument for parametric replacement Testing with the latest 5.5.x: Missing <tlib-version> gets: Mandatory TLD element missing or empty: tlib-version Missing TLD files gives: The absolute uri: XXXXX cannot be resolved in either web.xml or the jar files deployed with this application This is much better than it was when this bug was first raised but the first message could tell you which TLD has the problem. I've patched trunk and proposed the fix for 5.5.x and 6.0.x Fixed in trunk and will be in 6.0.21 onwards. This has been fixed in trunk and will be included in 5.5.28 onwards. |