Note that there are some explanatory texts on larger screens.

plurals
  1. POTomcat not seeing new files
    primarykey
    data
    text
    <p>I am creating an application which produces some files/directories in my WebContent folder and I would like Tomcat to serve these static files (logs of some background jobs). </p> <p>However Tomcat does not seem to recognize new files (maybe files in new folders), and it keeps returning 404 for them. After Tomcat restart, the files are served Ok.</p> <p>I am using Tomcat 7.0, form within the Eclipse. The files are served by the default servlet.</p> <p>I assume that Tomcat somehow traverses WebContent initially and it just uses this cached list of files for faster operation. Is there a way to disable such a behavior (or maybe: what is the right way to serve new files generated by other processes)?</p> <p>Thanks for help/suggestions. I am quite newbie to Tomcat, so I might be overlooking something basic.</p> <p><strong>Update (based on accepted solution)</strong></p> <p>There seems to be some duality in the webapp folder. One is in the Eclipse project (and is returned by <code>getServletContext().getRealPath</code>, the other is by default somewhere in Eclipse metadata and can be seen in launch config in <code>wtp.deploy</code> property. The files are somehow copied from Eclipse to the deploy dir. When I started to generate my files under <code>wtp.deploy</code>, the problem got fixed.</p> <p>However, I still don't know, how to solve this in proper way, which will work both under Eclipse WTP and in normal Tomcat conditions.</p> <p><strong>Update</strong></p> <p>The final solution was to avoid <code>DefaultServlet</code> at all. I used <code>FileServlet</code> based on <a href="http://balusc.blogspot.com/2009/02/fileservlet-supporting-resume-and.html" rel="nofollow">http://balusc.blogspot.com/2009/02/fileservlet-supporting-resume-and.html</a> and it works fine.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload