Search code examples
spring-mvcjettyweb.xmltomcat8meta-inf

Unable to serve /WEB-INF/lib/*.jar!/META-INF/resources/ content


I have a GWT-Spring project and I have also two modules which are used as a libraries in the web project, everything works fine, but I'm trying to put some static resources on one of those modules (JAR) but I'm not seeing my resources when the application is deployed, I'm just getting a 404 when I try to get them.

I'm using Servlet 3.0 in the web.xml and I put this line in my application-config:

<mvc:resources mapping="/resources/**"  location="classpath:/META-INF/resources" ></mvc:resources>

Also I put all my resources under the folder META-INF/resources inside the JAR.

Running the project with Jetty (IntelliJ) if I go to: http://localhost:8888/path/resources I can see the whole list of those folders (All folders I put on the META-INF/resources JAR and the resources on the web project, but about the JAR I can see only the folders, not the files on them!.)

And if I run the project with tomcat I can see only the resources on the web project but anything from the JAR.

Any ideas?


Solution

  • I found the issue.

    This was just a security problem, if the URLs are protected any resource will be available if there's no a session started.

    Additionally the resources inside of the WEB-INF/lib/*.jar!/META-INF/resources aren't published under another "resources" folder but published on the root directly.

    Thanks.