Search code examples
jettyjsp-tagsmaven-jetty-plugin

Tags included from libraries in `WEB-INF/lib` folder stopped working after update to Jetty 9.2.2.v20140723


I updated Jetty (and Jetty Maven plugin) from 9.2.1.v20140609 to 9.2.2.v20140723 and now this exception is thrown when I try to access any webpage of my application:

org.apache.jasper.JasperException: /WEB-INF/(...).jsp (line: 2, column: 0)
The absolute uri: http://www.springframework.org/security/tags cannot be resolved
in either web.xml or the jar files deployed with this application

Currently I use

<%@ taglib uri="http://www.springframework.org/security/tags" prefix="security"%>

in top of all JSP files and Spring Security tags are included in WAR file:

ROOT.war content

When I extract *.tld file from JAR, put in WEB-INF and manually include it using

<jsp-config>
        <taglib>
            <taglib-uri>http://www.springframework.org/security/tags</taglib-uri>
            <taglib-location>security.tld</taglib-location>
        </taglib>
</jsp-config>

in web.xml, it start working again. But I will have to do it for all tags from all libraries...

Seems that Jetty somehow stopped scanning WEB-INF/lib for *.tld files. How do I fix this?


Solution

  • OK, I figured it out.

    In pom.xml I had

    <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty.version}</version>
    
        <configuration>
            <!-- (...) --->
            <contextXml>${basedir}/path/to/jetty-context.xml</contextXml>-->
            <!-- (...) --->
        <configuration>
    </plugin>
    

    and in jetty-context.xml I had

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
    
    <Configure class="org.eclipse.jetty.webapp.WebAppContext">
        <Set name="maxFormKeys">8000</Set>
        <Call name="setAttribute">
            <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
            <Arg>.*/.*jsp-api-[^/]\.jar$|./.*jsp-[^/]\.jar$|./.*taglibs[^/]*\.jar$</Arg>
        </Call>
    </Configure>
    

    I removed both <contextXml> from POM and jetty-context.xml and everything is working again.