Bug 33373 - jspc precompiling jsp with absolute uri in taglib fails
jspc precompiling jsp with absolute uri in taglib fails
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Jasper
5.5.7
PC Windows XP
: P2 normal with 1 vote (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
: 33358 34134 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-02-02 22:46 UTC by Jason Schuchert
Modified: 2005-03-22 10:47 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Schuchert 2005-02-02 22:46:01 UTC
i upgraded from 5.5.4 to 5.5.7 and noticed that my ant jsp precompile task was 
failing for .jsp files that were referencing taglibs.  the message it gives is:

org.apache.jasper.JasperException: The absolute uri: 
http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or the 
jar files deployed with this application

the line in the offending jsp looks like:

<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

if i go into the jstl taglib jar file and grab the sql.tld file and put it into 
my WEB-INF then the jspc task works.

in 5.5.4 this worked without having the sql.tld file in WEB-INF (it was just 
found in the .jar file of the tag library)
Comment 1 Remy Maucherat 2005-02-02 22:51:55 UTC
I am not aware of any relevant changes. Please provide a ready to test war.
Comment 2 Jason Schuchert 2005-02-03 01:21:33 UTC
there were changes to o.a.jasper.jspc.java concerning the classloader.  i can't 
demonstrate this in a ready to run war since the problem doesn't happen if i 
let jsp's compile at runtime.  this is only happening to me at precompile 
time.  i did some more testing and have narrowed the behavior down to a case 
where if i have 2 .jsp files named a.jsp and b.jsp and the second one 
alphabetically (b.jsp) has the taglib reference but a.jsp doesn't, then the bug 
happens.  if i rename a.jsp to c.jsp so that the non taglib jsp comes after the 
taglib one, then it works.  it appears that something magic is happening so 
that precompiling with taglibs only works if the first jsp that is processed by 
jspc.java contains a taglib reference.  if you diff jspc.java between 5.5.4 and 
5.5.7 you'll see a number of changes regarding its management of the 
classloader that may or may not be the culprit.  hope this is of some help :)
Comment 3 Remy Maucherat 2005-02-03 01:28:41 UTC
The jspc changes are not relevant. Without a test war -> invalid.

BTW, jsp-examples is precompiled as part of the Tomcat build process. It
contains JSTL pages, without expanded TLDs. Do you have any explanation as to
why it precompiles without errors ?
Comment 4 Jason Schuchert 2005-02-03 16:15:46 UTC
excellent point :)  i downloaded 5.5.7-src.zip and am able to compile it under 
cygwin on win xp.  you are correct that the jsp-examples precompile correctly.  
once it had all compiled successfully, i dropped one new .jsp into 
the .../jakarta-tomcat-5.5.7-src/jakarta-servletapi-5/jsr152/examples/tagplugin 
directory.  this jsp is named aaa_breaks_jspprecompile.jsp and contains has one 
line it:

<h3>no taglib uri reference in first file alphabetically makes jspc die</h3>

(note there is no reference to a taglib)

i then did a touch *.jsp in that tagplugin directory to make all the .jsp's out 
of date and re-ran ant and sure enough i get:

build-webapps-precompile:

BUILD FAILED
C:\workspace\toolbelt\tomcat\jakarta-tomcat-5.5.7-src\build.xml:50: The followin
g error occurred while executing this line:
C:\workspace\toolbelt\tomcat\jakarta-tomcat-5.5.7-src\jakarta-tomcat-5\build.xml
:767: The following error occurred while executing this line:
C:\workspace\toolbelt\tomcat\jakarta-tomcat-5.5.7-src\jakarta-tomcat-5\build.xml
:372: org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/j
sp/jstl/core cannot be resolved in either web.xml or the jar files deployed with
 this application

i know this sounds crazy, but it appears that as long as the first .jsp file 
(sorted alphabetically) in any given directory of a webapp does NOT use 
taglibs, then no other jsp in that same directory that uses taglibs will 
precompile.  hopefully it's easy for you to create the 
aaa_breaks_jspprecompile.jsp file in the above mentioned directory and 
replicate the problem in your own build environment.  i apologize for not 
attaching a war file but demonstrating the problem only requires this 
single .jsp and a touch *.jsp so that all files in that subdir are marked as 
out of date.  thanks!
Comment 5 Remy Maucherat 2005-02-08 15:08:08 UTC
That's a good example. This should be fixed now.
Comment 6 Remy Maucherat 2005-02-10 15:10:10 UTC
*** Bug 33358 has been marked as a duplicate of this bug. ***
Comment 7 Remy Maucherat 2005-03-22 19:47:32 UTC
*** Bug 34134 has been marked as a duplicate of this bug. ***