Bug 53541

Summary: Bug in virtual webapp feature. Custom tags badly supported. Error is "org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application"
Product: Tomcat 7 Reporter: Philip <philipzuev>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: major CC: philipzuev
Priority: P2    
Version: 7.0.28   
Target Milestone: ---   
Hardware: PC   
OS: All   
URL: https://docs.google.com/open?id=0B1YRF9AZ53VhSlJaRkY5dS1aZW8

Description Philip 2012-07-12 18:16:08 UTC
Defect report - briefly:
Tomcat implements “virtual webapp” feature. For details, see http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Virtual_webapp
Tomcat 7.0.28 implementation of “virtual webapp” has a defect – it does not allow developer to use tag library from WEB-INF/lib/*.jar. For example, developer can’t put well known jstl-1.2.jar into WEB-INF/lib/ and use it.

Defect report – detailed:
Proof of concept web application - lite-filter-mdot-1.0.0-BUILD-SNAPSHOT-sources.jar. Really, it’s a sample web app downloaded from Spring Source.  You can download it from https://github.com/SpringSource/spring-mobile-samples. I just changed POM a little bit to remove redundant samples.

Error screenshot – error.png

Zipped tomcat CONF directory – defect-conf.zip
======From Spring.xml========
<Context path="/spring" docBase="C:/Users/Filipp_Zuev/workspace/lite-filter-mdot/src/main/webapp" >
  <Resources className="org.apache.naming.resources.VirtualDirContext"
    extraResourcePaths=
      "/WEB-INF/classes=C:/Users/Filipp_Zuev/workspace/lite-filter-mdot/target/classes,/WEB-INF/lib=C:/Users/Filipp_Zuev/workspace/lite-filter-mdot/target/lite-filter-mdot-1.0.0-BUILD-SNAPSHOT/WEB-INF/lib" />
  <Loader className="org.apache.catalina.loader.VirtualWebappLoader"
    virtualClasspath="C:/Users/Filipp_Zuev/workspace/lite-filter-mdot/target/classes;
      C:/Users/Filipp_Zuev/workspace/lite-filter-mdot/target/lite-filter-mdot-1.0.0-BUILD-SNAPSHOT/WEB-INF/lib/*.jar" />
  <JarScanner scanAllDirectories="true" />
</Context>
=============
Tomcat log file - catalina.2012-07-12.log

Defect–fix suggested:
Add this method to org.apache.naming.resources.VirtualDirContext
@Override
	protected String doGetRealPath(String path) {
        File file = file(path);
        if(null!=file){
        	return file.getAbsolutePath();
        }else{
        	return null;
        }
    }

Defect–fix suggested-proof of concept:
1.	Deploy attached tomcat-extension-0.0.1-SNAPSHOT.jar with me.tomcat.bugfix.workaround.VirtualDirContext.class into Tomcat’s common lib directory.
2.	In the Context configuration for the proof of concept application replace org.apache.naming.resources.VirtualDirContext for me.tomcat.bugfix.workaround.VirtualDirContext
3.	Restart tomcat. 
Defect fixed!
Comment 1 Philip 2012-07-12 18:29:58 UTC
All configs, sources, logs mentioned in the defect report, can be downloaded here - https://docs.google.com/open?id=0B1YRF9AZ53VhSlJaRkY5dS1aZW8

P.S.
Bugzilla limited me to 1kb per attachement, it's very unuseful.
Comment 2 Mark Thomas 2012-08-10 16:27:23 UTC
For the record, the maximum permitted attachment size is 1MB, not 1KB. 1MB should be more than enough for any test case - even one packaged as a WAR - providing it meets the standard of "the minimum necessary to demonstrate the bug".
Comment 3 Mark Thomas 2012-08-10 19:57:30 UTC
This has been fixed in trunk and 7.0.x and will be included in 7.0.30 onwards.

Regarding the test case, it would have been a lot easier to work with if necessary files to recreate this were provided in a zip/tar.gz that matched the necessary file structure. A lot of reverse engineering was required to recreate the test case before the bug could be investigated.
Comment 4 Philip 2012-08-11 05:44:34 UTC
(In reply to comment #3)
> This has been fixed in trunk and 7.0.x and will be included in 7.0.30
> onwards.
> 
> Regarding the test case, it would have been a lot easier to work with if
> necessary files to recreate this were provided in a zip/tar.gz that matched
> the necessary file structure. A lot of reverse engineering was required to
> recreate the test case before the bug could be investigated.
Thank you for your response, Mark.
It's my pleasure to help you improve Tomcat!
Sorry, if test case was non convenient. Next time it will be better.