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 ...>

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:

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.

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


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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org

Reply via email to