Resources in META-INF / resources not found and not returned 404

I have a jar file in my WEB-INF / lib directory. Inside this can is the META-INF / resources directory with one file (image.jpg). As far as I understand the servlet 3.0 API, when I deploy it as part of my web application under Tomcat 7, I should be able to switch to

http://host/context/image.jpg 

and see the image downloaded from the can. but instead I get error 404. As if servlet_api is not loading resources from my cans, even if the documentation says that it should be.

What am I doing wrong? Is there a field that I need to put in the web.xml file to tell tomcat to download these resources and make them available for a web browser?

+5
source share
2

. Tomcat 7 Servlet 3.0, , web.xml , 3.0. Tomcat , Servlet 3.0.

web.xml - :

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

3.0

- 3.0, Servlet 3.0.

+5

, - .

catalina.properties:

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*

Tomcat.

Tomcat 9, jar . :

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

.

0

All Articles