Bug 43743 - Cannot jspc precompile jsps with nested .tag files
Summary: Cannot jspc precompile jsps with nested .tag files
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 6.0.9
Hardware: All All
: P3 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2007-10-30 21:25 UTC by Anthony Berglas
Modified: 2008-01-10 13:46 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Berglas 2007-10-30 21:25:38 UTC
myjsp.jsp:  HELLO <tag1/>
tag1.tag:  <tag2>
tag2.tag:  WORLD

Crashes (null pointer)  while trying to load tag2.class, called by  

Very Initial analysis:-
TagFileProcessor.loadTagFile creates wrapper, but ctxt.getTagFileJarUrl
(tagFilePath) returns null for nested .tag.
Thus in JspCompilationContext.Compile  JspCCtx.isPackagedFile == false, so 
outDated test is wrong
So tag2.tag not compiled, thus class cannot be loaded.

But problem also appears if tags not packaged in a .jar, so there is more 
going on.

Work around is to create dummy.jsp that calls the .tags in leaf first order 
so .class files are created.
Comment 1 Anthony Berglas 2007-10-30 23:35:04 UTC
Correction: Problem ONLY appears if nested tag is in a jar file.
Comment 2 Anthony Berglas 2007-10-31 02:08:13 UTC
The bug appears to be in Parser.parseTaglibDirective.

A JspCompilerContext instance is created for each JSP and each Tag file 
The tag file url map is stored here, not globally.  This is what 
JspCompilerContext.compile uses.

But Parser.parseTaglibDirective only calls TagLibraryInfoImpl() once per JSP, 
not and not for the sub tag files.
So the map is never populated.

A hack workaround it to set caching="false" in the <jspc ...> command. 
I'm not sure what the full implications of doing this are.

From here I think a proper fix should be fairly straight forward.
Comment 3 Mark Thomas 2008-01-10 13:46:51 UTC
This is fixed in svn and will be included in 6.0.16 onwards.