Tomcat can not find the resources


Well I have an application with AngularJS that makes requests to the %% %% API as an example to learn how to use AngularJS, but the problem is that when I put the page with all the dependencies in a% Java% (this is what I do because I need to use REST services defined with Jersey), and I run it with gitHub , I throw the following errors in the Chrome dev console (I try it in Chrome because in the Dynamic Web Project browser I do not have a developer console to trace the errors).

The first time I try to enter Tomcat 8.0.36 this happens: Then show this log when I keep trying to enter: This is the log if I open the index.html directly from a folder, without putting it inside the Java Dynamic Web Project:

I leave you my directory tree of the Java project ( Eclipse is not implemented yet, it does not do anything):

asked by Augusto Herbel 18.09.2016 в 07:54

2 answers


The error images show the cause of the problem, along with the image of the structure of your project. Your resources are inside the WEB-INF folder, which is not visible in browsers . Application servers in Java do not show the contents of this folder.

To solve your problem, simply move the location files to outside the WEB-INF folder. The structure of your project would be as follows:

- resources (aquí van tus recursos JS, CSS, etc)
  - css
  - fonts
  - images
  - js
  - lib
  - (otras carpetas...)
  + web.xml
  - (otros archivos y carpetas para la configuración de tu proyecto como web.xml)
answered by 19.09.2016 / 16:25

Just a little clarification, the files of the web-inf folder if they can be accessed, only web pages (jsp, xhtml, html), but to access the files inside this folder, you have to go through a controller, not will be accessible through a url, which is a good practice for safety and follows the pattern MVC.


answered by 20.09.2016 в 01:11