tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomas Hofman <thof...@redhat.com>
Subject TLD files packaged in JAR required to be under META-INF/resources?
Date Wed, 30 May 2018 10:13:48 GMT
Hello,

I run into something that looks like non spec-conforming behavior and would 
like to check with you if it's really a bug or I'm having incorrect expectations.

I have TLD located in JAR under META-INF/tlds/hi.tld. The JAR also contains 
web-fragment.xml with taglib mapping like this:

   <web-fragment ...>
     <jsp-config>
         <taglib>
             <taglib-uri>/HiTag</taglib-uri>
             <taglib-location>/tlds/hi.tld</taglib-location>
         </taglib>
     </jsp-config>
   </web-fragment>

This JAR is loaded in a WAR, that contains JSP with following directive:

   <%@ taglib uri="/HiTag" prefix="say"%>

During deployment in apache-tomcat-9.0.8 I see this warning:

30-May-2018 10:38:42.240 WARNING 
[ContainerBackgroundProcessor[StandardEngine[Catalina]]] 
org.apache.jasper.servlet.TldScanner.scanJspConfig Failed to process TLD with 
path [/tlds/hi.tld] and URI [/HiTag]. The specified path does not exist.

and the jsp compilation fails.

When I move the TLD under META-INF/resources, then it starts to work.
When I use implicit mapping by defining <uri> element in hi.tld instead of 
explicit mapping in web-fragment.xml, that works too.

The JSP spec says that TLDs must be in META-INF/ or subdirectories:

[quote]
JSP 7.3.1

When deployed inside a JAR file, the tag library descriptor files must be in 
the META-INF directory, or a subdirectory of it.
[/quote]

I think it's caused by this line in TldScanner.java:

https://github.com/apache/tomcat/blob/TOMCAT_8_0_0_RC10/java/org/apache/jasper/servlet/TldScanner.java#L177

where ServletContext#getResource() would naturally see only files under 
META-INF/resources/ dir.

Thanks for any opinions!

-- 
Tomas Hofman
Software Engineer, JBoss SET
Red Hat

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
For additional commands, e-mail: taglibs-user-help@tomcat.apache.org


Mime
View raw message