resources in META-INF/resources not found and return 404

The way the jar is built is correct. Tomcat 7 ships with the Servlet 3.0 jar, but it will not serve resources out of the jar unless the web.xml specifically states that it is version 3.0. Tomcat will not assume you want Servlet 3.0 functionality.

In your web.xml, your web-app tag need to start like this:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">

Note the references to version 3.0

As soon as you specify the web-app is version 3.0, you'll gain access to Servlet 3.0 functionality.


Maybye it helps someone.

Some people make in their catalina.properties:

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*

to spped up Tomcat start time.

If I did it on my Tomcat 9, the resources in jar was for me unaccesible. I had to make exception:

tomcat.util.scan.StandardJarScanFilter.jarsToScan = libraryWithResources.jar,....

and the problem went away.